[zaptel-commits] tzafrir: branch 1.2 r2868 - /branches/1.2/Makefile

SVN commits to the Zaptel project zaptel-commits at lists.digium.com
Fri Aug 17 01:53:54 CDT 2007


Author: tzafrir
Date: Fri Aug 17 01:53:53 2007
New Revision: 2868

URL: http://svn.digium.com/view/zaptel?view=rev&rev=2868
Log:
* Make sure every userspace tool is built with CFLAGS and LDFLAGS.
* Search for newt.h in INCLUDE_DIR.
* Build makefw and gendigits with HOSTCC .
* Don't build makefw in the 'programs' target.

Modified:
    branches/1.2/Makefile

Modified: branches/1.2/Makefile
URL: http://svn.digium.com/view/zaptel/branches/1.2/Makefile?view=diff&rev=2868&r1=2867&r2=2868
==============================================================================
--- branches/1.2/Makefile (original)
+++ branches/1.2/Makefile Fri Aug 17 01:53:53 2007
@@ -136,6 +136,19 @@
 #We only support DEVFS in linux 2.4 kernels, since its considered obsolete post 2.4
 DYNFS:=$(shell ps ax | grep -v grep | grep -q devfsd && echo "yes")
 endif
+
+# Utilities we build with a standard build procedure:
+UTILS		= tor2ee zttool zttest ztmonitor ztspeed sethdlc-new ztcfg \
+		  ztcfg-dude usbfxstest fxstest fxotune ztdiag torisatool
+
+# Makefile mentions them. Source is not included (anynore?)
+UTILS		+= fxsdump ztprovision
+
+# some tests:
+UTILS		+= patgen pattest patlooptest hdlcstress hdlctest hdlcgen \
+		   hdlcverify timertest
+
+UTILSO		= $(UTILS:%=%.o)
 
 # sample makefile "trace print"
 #tracedummy=$(shell echo ====== GOT HERE ===== >&2; echo >&2)
@@ -188,8 +201,8 @@
 MANDIR			= /usr/share/man/man8
 MODS_DIR		:= /lib/modules/$(KVERS)/misc
 MAN_PAGES_BASE		= ztcfg 
-BINS=ztcfg torisatool makefw ztmonitor ztspeed zttest fxotune
-ifneq (,$(wildcard /usr/include/newt.h))
+BINS=ztcfg torisatool ztmonitor ztspeed zttest fxotune
+ifneq (,$(wildcard $(INCLUDE_DIR)/newt.h))
 BINS+=zttool
 MAN_PAGES_BASE		+= zttool
 endif
@@ -266,19 +279,8 @@
 $(filter-out zaptel.o,$(MODULESO)) zaptel-base.o: %.o: %.c
 	$(CC) $(KFLAGS) -o $@ -c $<
 
-tor2ee.o: tor2-hw.h
-
-tor2ee: tor2ee.o
-	$(CC) $(CFLAGS) -o $@ $^ -lpci
-
-zonedata.lo: zonedata.c
+zonedata.lo tonezone.lo: %.lo: %.c
 	$(CC) -c $(LCFLAGS) -o $@ $^
-
-tonezone.lo: tonezone.c
-	$(CC) -c $(LCFLAGS) -o $@ $^
-
-torisatool: torisatool.o
-	$(CC) -o $@ $^
 
 tones.h: gendigits
 	./gendigits > $@
@@ -289,72 +291,64 @@
 radfw.h: makefw pciradio.rbt
 	./makefw pciradio.rbt radfw > radfw.h
 
-gendigits: gendigits.o
-	$(CC) -o $@ $^ -lm
+gendigits makefw: %: %.c
+	$(HOSTCC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
+
+$(UTILS): %: %.o
+	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
+
+$(UTILSO): %.o: %.c
+	$(CC) $(CFLAGS) -c $<
+
+gendigits: LDFLAGS+=-lm
 
 prereq: tones.h tor2fw.h radfw.h version.h
 
 zttool.o: zttool.c zaptel.h
+zttool: LDFLAGS+=-lnewt
+
+tor2ee.o: tor2-hw.h
+tor2ee: LDFLAGS+=-lpci
 
 ztprovision.o: ztprovision.c zaptel.h
 
 ztmonitor.o: ztmonitor.c zaptel.h
 
-ztspeed.o: ztspeed.c
-	$(CC) -o $@ -c $^
-
-zttool: zttool.o
-	$(CC) -o $@ $^ -lnewt
-
-ztmonitor: ztmonitor.o
-	$(CC) -o $@ $^
-
-ztspeed: ztspeed.o
-	$(CC) -o $@ $^
-
-sethdlc-new: sethdlc-new.o
-	$(CC) -o $@ $^
-
-sethdlc-new.o: sethdlc-new.c
-	$(CC) -o $@ -c $(CFLAGS) -I$(KINCLUDES) $^
+# make sure it is not optimized:
+ztspeed.o: CFLAGS=
+ztspeed: CFLAGS=
+
+sethdlc-new.o: CFLAGS+=-I$(KINCLUDES)
 
 libtonezone.a: $(TZOBJS)
 	ar rcs libtonezone.a $^
 
 $(LIBTONEZONE_SO): $(TZOBJS)
-	$(CC) -shared -Wl,-soname,$(LIBTONEZONE_SO).$(LIBTONEZONE_SO_MAJOR_VER).$(LIBTONEZONE_SO_MINOR_VER) -lm -o $@ $^
+	$(CC) $(CFLAGS) -shared -Wl,-soname,$(LIBTONEZONE_SO).$(LIBTONEZONE_SO_MAJOR_VER).$(LIBTONEZONE_SO_MINOR_VER) -lm -o $@ $^ $(LDFLAGS)
 
 ztcfg.c: ztcfg.h
 
 ztcfg-shared: ztcfg.o $(LIBTONEZONE_SO)
-	$(CC) -o $@ $^ -lm
+	$(CC) $(CFLAGS) -o $@ $^ -lm $(LDFLAGS)
 
 ztcfg: ztcfg.o libtonezone.a
-	$(CC) -o $@ $^ -lm
-
+ztcfg: LDFLAGS+=-lm
+
+ztcfg-dude: LDFLAGS+=-lm -lstdc++
 ztcfg-dude: ztcfg-dude.o mknotch.o complex.o $(LIBTONEZONE_SO)
-	$(CC) -o $@ $^ -lm -lstdc++
-
-mknotch.o: mknotch.cc
-	$(CC) -o $@ -c $^
-
-complex.o: complex.cc
-	$(CC) -o $@ -c $^
-
-usbfxstest.o: usbfxstest.c
-	$(CC) -o $@ -g -c $^
-
-usbfxstest: usbfxstest.o 
-	$(CC) -o $@ $^ -lzap
+
+# FIXME: we assume CC can build the C++ modules:
+complex.o mknotch.o: %.o: %.cc
+	$(CC) $(CFLAGS) -o $@ -c $<
+
+usbfxstest: LDFLAGS+=-lzap
 
 fxstest: fxstest.o $(LIBTONEZONE_SO)
-	$(CC) -o $@ $^ -lm
-
-fxotune: fxotune.o
-	$(CC) -o $@ $^ -lm
-
-fxsdump: fxsdump.o
-	$(CC) -o $@ $^ -lm
+fxstest: LDFLAGS+=-lm
+
+fxotune: LDFLAGS+=-lm
+
+fxsdump: LDFLAGS+=-lm
 
 stackcheck: checkstack all
 	./checkstack *.ko */*.ko
@@ -364,9 +358,6 @@
 
 xpp/README.html: xpp/README.Astribank
 	cd $(@D); asciidoc -n -a toc $(<F)
-
-ztdiag: ztdiag.o 
-	$(CC) -o $@ $^
 
 devices:
 ifndef DYNFS




More information about the zaptel-commits mailing list