summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-08-17 06:53:53 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-08-17 06:53:53 +0000
commit46cd75006d685997be6e62c88e168005eb8adad4 (patch)
treed5e02df81c24573b2d5d943562747144add00867 /Makefile
parent51116d966175c617d123501b5a428e09e908eded (diff)
* 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. git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@2868 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile99
1 files changed, 45 insertions, 54 deletions
diff --git a/Makefile b/Makefile
index 75d7f74..1cf0840 100644
--- a/Makefile
+++ b/Makefile
@@ -137,6 +137,19 @@ ifeq ($(BUILDVER),linux24)
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 @@ SBINDIR := /sbin
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,20 +279,9 @@ zaptel.o: zaptel-base.o $(ZAPTEL_HPEC)
$(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
- $(CC) -c $(LCFLAGS) -o $@ $^
-
-tonezone.lo: tonezone.c
+zonedata.lo tonezone.lo: %.lo: %.c
$(CC) -c $(LCFLAGS) -o $@ $^
-torisatool: torisatool.o
- $(CC) -o $@ $^
-
tones.h: gendigits
./gendigits > $@
@@ -289,72 +291,64 @@ tor2fw.h: makefw tormenta2.rbt
radfw.h: makefw pciradio.rbt
./makefw pciradio.rbt radfw > radfw.h
-gendigits: gendigits.o
- $(CC) -o $@ $^ -lm
+gendigits makefw: %: %.c
+ $(HOSTCC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
-prereq: tones.h tor2fw.h radfw.h version.h
+$(UTILS): %: %.o
+ $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
-zttool.o: zttool.c zaptel.h
+$(UTILSO): %.o: %.c
+ $(CC) $(CFLAGS) -c $<
-ztprovision.o: ztprovision.c zaptel.h
+gendigits: LDFLAGS+=-lm
-ztmonitor.o: ztmonitor.c zaptel.h
+prereq: tones.h tor2fw.h radfw.h version.h
-ztspeed.o: ztspeed.c
- $(CC) -o $@ -c $^
+zttool.o: zttool.c zaptel.h
+zttool: LDFLAGS+=-lnewt
-zttool: zttool.o
- $(CC) -o $@ $^ -lnewt
+tor2ee.o: tor2-hw.h
+tor2ee: LDFLAGS+=-lpci
-ztmonitor: ztmonitor.o
- $(CC) -o $@ $^
+ztprovision.o: ztprovision.c zaptel.h
-ztspeed: ztspeed.o
- $(CC) -o $@ $^
+ztmonitor.o: ztmonitor.c zaptel.h
-sethdlc-new: sethdlc-new.o
- $(CC) -o $@ $^
+# make sure it is not optimized:
+ztspeed.o: CFLAGS=
+ztspeed: CFLAGS=
-sethdlc-new.o: sethdlc-new.c
- $(CC) -o $@ -c $(CFLAGS) -I$(KINCLUDES) $^
+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 $^
+# FIXME: we assume CC can build the C++ modules:
+complex.o mknotch.o: %.o: %.cc
+ $(CC) $(CFLAGS) -o $@ -c $<
-usbfxstest.o: usbfxstest.c
- $(CC) -o $@ -g -c $^
-
-usbfxstest: usbfxstest.o
- $(CC) -o $@ $^ -lzap
+usbfxstest: LDFLAGS+=-lzap
fxstest: fxstest.o $(LIBTONEZONE_SO)
- $(CC) -o $@ $^ -lm
+fxstest: LDFLAGS+=-lm
-fxotune: fxotune.o
- $(CC) -o $@ $^ -lm
+fxotune: LDFLAGS+=-lm
-fxsdump: fxsdump.o
- $(CC) -o $@ $^ -lm
+fxsdump: LDFLAGS+=-lm
stackcheck: checkstack all
./checkstack *.ko */*.ko
@@ -365,9 +359,6 @@ README.html: README
xpp/README.html: xpp/README.Astribank
cd $(@D); asciidoc -n -a toc $(<F)
-ztdiag: ztdiag.o
- $(CC) -o $@ $^
-
devices:
ifndef DYNFS
mkdir -p $(DESTDIR)/dev/zap