Description: Simplify upstream Makefile (Thks mvanderkolff)
Author: Mark Purcell <msp@debian.org>
Bug-Debian: http://bugs.debian.org/584501

--- t38modem-1.2.0.orig/Makefile
+++ t38modem-1.2.0/Makefile
@@ -97,59 +97,29 @@
 #
 #
 
-PROG		= t38modem
-SOURCES		:= pmutils.cxx dle.cxx pmodem.cxx pmodemi.cxx drivers.cxx \
-		   t30tone.cxx hdlc.cxx t30.cxx fcs.cxx \
-		   pmodeme.cxx enginebase.cxx t38engine.cxx audio.cxx \
-		   drv_pty.cxx \
-		   main_process.cxx
-
-#
-# Build t38modem for
-#  - Open Phone Abstraction Library if defined USE_OPAL
-#  - Open H323 Library or H323 Plus Library if not defined USE_OPAL
-#    (NOTE: define NO_PBOOLEAN for Open H323 Library)
-#
-ifdef USE_OPAL
-  VPATH_CXX := opal
-
-  SOURCES += \
-             opalutils.cxx \
-             modemep.cxx modemstrm.cxx \
-             h323ep.cxx \
-             sipep.cxx \
-             manager.cxx
-
-  ifndef OPALDIR
-    OPALDIR=$(HOME)/opal
-  endif
-
-  OBJDIR_SUFFIX = _opal$(OBJ_SUFFIX)
-  STDCCFLAGS += -DUSE_OPAL
-
-  include $(OPALDIR)/opal_inc.mak
-else
-  VPATH_CXX := h323lib
-
-  SOURCES += t38protocol.cxx g7231_fake.cxx h323ep.cxx
+%.o: %.cxx
+	$(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
 
-  ifndef OPENH323DIR
-    OPENH323DIR=$(HOME)/openh323
-  endif
-
-  include $(OPENH323DIR)/openh323u.mak
-
-  ifdef NO_PBOOLEAN
-    STDCCFLAGS += -DPBoolean=BOOL
-  endif
-endif
+PROG		= t38modem
+OBJECTS         := pmutils.o dle.o pmodem.o pmodemi.o drivers.o t30tone.o hdlc.o t30.o fcs.o pmodeme.o enginebase.o t38engine.o audio.o drv_pty.o main_process.o \
+                   opal/opalutils.o opal/modemep.o opal/modemstrm.o opal/h323ep.o opal/sipep.o opal/manager.o
+#SOURCES renamed - but don't have explicit rules.
+#SOURCES		:= pmutils.cxx dle.cxx pmodem.cxx pmodemi.cxx drivers.cxx \
+#		   t30tone.cxx hdlc.cxx t30.cxx fcs.cxx \
+#		   pmodeme.cxx enginebase.cxx t38engine.cxx audio.cxx \
+#		   drv_pty.cxx \
+#		   main_process.cxx
+
+USE_UNIX98_PTY := 1
+CPPFLAGS += `pkg-config --libs --cflags opal`
+CPPFLAGS += -DUSE_OPAL
 
 #
 # If defined COUT_TRACE then enable duplicate the
 # output of myPTRACE() to cout
 #
 ifdef COUT_TRACE
-STDCCFLAGS += -DCOUT_TRACE
+CPPFLAGS += -DCOUT_TRACE
 endif
 
 #
@@ -161,7 +131,7 @@ endif
 # do not use --old-asn option).
 #
 ifdef OPTIMIZE_CORRIGENDUM_IFP
-STDCCFLAGS += -DOPTIMIZE_CORRIGENDUM_IFP
+CPPFLAGS += -DOPTIMIZE_CORRIGENDUM_IFP
 endif
 
 #
@@ -169,7 +139,7 @@ endif
 # output the trace with level N
 #
 ifdef MYPTRACE_LEVEL
-STDCCFLAGS += -DMYPTRACE_LEVEL=$(MYPTRACE_LEVEL)
+CPPFLAGS += -DMYPTRACE_LEVEL=$(MYPTRACE_LEVEL)
 endif
 
 #
@@ -177,7 +147,7 @@ endif
 # output the warnings on level N for big file descriptors
 #
 ifdef FD_TRACE_LEVEL
-STDCCFLAGS += -DFD_TRACE_LEVEL=$(FD_TRACE_LEVEL)
+CPPFLAGS += -DFD_TRACE_LEVEL=$(FD_TRACE_LEVEL)
 endif
 
 #
@@ -186,7 +156,7 @@ endif
 #  - CPU usage will be traced
 #
 ifdef PROCESS_PER_THREAD
-STDCCFLAGS += -DPROCESS_PER_THREAD
+CPPFLAGS += -DPROCESS_PER_THREAD
 endif
 
 #
@@ -194,7 +164,7 @@ endif
 # will repeat indicator sending on idle
 #
 ifdef REPEAT_INDICATOR_SENDING
-STDCCFLAGS += -DREPEAT_INDICATOR_SENDING
+CPPFLAGS += -DREPEAT_INDICATOR_SENDING
 endif
 
 #
@@ -205,12 +175,15 @@ endif
 # Both schemes cen be used simultaneously.
 #
 ifdef USE_UNIX98_PTY
-  STDCCFLAGS += -DUSE_UNIX98_PTY
+  CPPFLAGS += -DUSE_UNIX98_PTY
 
   ifdef USE_LEGACY_PTY
-    STDCCFLAGS += -DUSE_LEGACY_PTY
+    CPPFLAGS += -DUSE_LEGACY_PTY
   endif
 else
-  STDCCFLAGS += -DUSE_LEGACY_PTY
+  CPPFLAGS += -DUSE_LEGACY_PTY
 endif
 
+
+$(PROG) : $(OBJECTS)
+	$(CC) $(CPPFLAGS) -o $(PROG) $(OBJECTS)
