From b855d1814548c6d036503bf0428ce00c081bea5b Mon Sep 17 00:00:00 2001 From: Steven Dake Date: Thu, 16 Mar 2006 05:41:28 +0000 Subject: [PATCH] Patch from Hans Feldt This small patch (against r948) adds variable CPPFLAGS to all make rules that compiles `.c' files into `.o' files. This makes it possible to set CPPFLAGS on the command line as in: $ make CPPFLAGS=-DAMFDEBUG Editing the makefile when prototyping is then not needed. Another reason is that some of the openais C files are built using the implicit rule for C files (which uses CPPFLAGS). The change makes rules consistent with the implicit rule. It also adds a few missing files to the clean make target. git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@950 fd59a12c-fef9-0310-b244-a6a79926bd2f --- exec/Makefile | 44 ++++++++++++++++++++++---------------------- lcr/Makefile | 8 +++++--- lib/Makefile | 4 ++-- test/Makefile | 8 +++++--- 4 files changed, 34 insertions(+), 30 deletions(-) diff --git a/exec/Makefile b/exec/Makefile index 2c00b6f3..abd28972 100644 --- a/exec/Makefile +++ b/exec/Makefile @@ -173,73 +173,73 @@ clean: rm -f aisexec $(OBJS) *.o *.lcrso libtotem_pg.so.1.0 libtotem_pg.so.1 libtotem_pg.so libtotem_pg.a gmon.out keygen keygen.o openais-instantiate *.da *.bb *.bbg depend: - makedepend -Y -- $(CFLAGS) $(EXEC_SRC) $(TOTEM_SRC) > /dev/null 2>&1 + makedepend -Y -- $(CFLAGS) $(CPPFLAGS) $(EXEC_SRC) $(TOTEM_SRC) > /dev/null 2>&1 # - fPIC rules required for service handler shared objects ../lcr/lcr_ifact.o: ../lcr/lcr_ifact.c - $(CC) $(CFLAGS) -I../lcr -c -o $@ ../lcr/lcr_ifact.c + $(CC) $(CFLAGS) $(CPPFLAGS) -I../lcr -c -o $@ ../lcr/lcr_ifact.c evs.o: evs.c - $(CC) $(CFLAGS) -c -o $@ $(*F).c + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(*F).c clm.o: clm.c - $(CC) $(CFLAGS) -c -o $@ $(*F).c + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(*F).c amf.o: amf.c - $(CC) $(CFLAGS) -c -o $@ $(*F).c + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(*F).c ckpt.o: ckpt.c - $(CC) $(CFLAGS) -c -o $@ $(*F).c + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(*F).c evt.o: evt.c - $(CC) $(CFLAGS) -c -o $@ $(*F).c + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(*F).c lck.o: lck.c - $(CC) $(CFLAGS) -c -o $@ $(*F).c + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(*F).c msg.o: msg.c - $(CC) $(CFLAGS) -c -o $@ $(*F).c + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(*F).c cfg.o: cfg.c - $(CC) $(CFLAGS) -c -o $@ $(*F).c + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(*F).c cpg.o: cpg.c - $(CC) $(CFLAGS) -c -o $@ $(*F).c + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(*F).c # -fPIC rules required for lib totem aispoll.o: aispoll.c - $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c + $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c totempg.o: totempg.c - $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c + $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c totemsrp.o: totemsrp.c - $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c + $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c totemrrp.o: totemrrp.c - $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c + $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c totemip.o: totemip.c - $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c + $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c totemnet.o: totemnet.c - $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c + $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c wthread.o: wthread.c - $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c + $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c tlist.o: tlist.c - $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c + $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c crypto.o: crypto.c - $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c + $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c totemmrp.o: totemmrp.c - $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c + $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c totemconfig.o: totemconfig.c - $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c + $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c # DO NOT DELETE diff --git a/lcr/Makefile b/lcr/Makefile index 09473950..ef4fc742 100755 --- a/lcr/Makefile +++ b/lcr/Makefile @@ -66,10 +66,12 @@ uic: uic.o $(CC) $(LDFLAGS) uic.o -o uic libtest_a.o: libtest_a.c - $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c + $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c libtest_b.o: libtest_b.c - $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c + $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c clean: - rm -f test libtest.so* *.o uic liblcr.so* liblcr.a *.lcrso *.da *.ba *.bb *.bbg + rm -f test libtest.so* *.o uic liblcr.so* liblcr.a *.lcrso *.da *.ba *.bb *.bbg \ + test_static + diff --git a/lib/Makefile b/lib/Makefile index c56ad756..a731574c 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -193,10 +193,10 @@ clean: # -fPIC rules required for all libraries %.o: %.c - $(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c + $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $(*F).c depend: - makedepend -Y -- $(CFLAGS) $(LIBAIS_SRC) > /dev/null 2>&1 + makedepend -Y -- $(CFLAGS) $(CPPFLAGS) $(LIBAIS_SRC) > /dev/null 2>&1 # DO NOT DELETE util.o: ../include/saAis.h ../include/ipc_gen.h ../exec/totemip.h util.h diff --git a/test/Makefile b/test/Makefile index 9506a85a..9412e0c0 100644 --- a/test/Makefile +++ b/test/Makefile @@ -142,12 +142,14 @@ clean: rm -f *.o testclm testamf testamf1 testamf2 testamf3 testamf4 \ testamf5 testamf6 testamfth testckpt ckptstress testtimer \ ckptbench ckptbenchth testevt testevs ckpt-wr ckpt-rd \ - evsbench subscription publish evtbench unlink testmsg testcpg + evsbench subscription publish evtbench unlink testmsg testcpg \ + testclm2 testlck + %.o: %.c - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< + $(CC) $(CFLAGS) $(CPPFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< depend: - makedepend -Y -- $(CFLAGS) $(TEST_SRC) > /dev/null 2>&1 + makedepend -Y -- $(CFLAGS) $(CPPFLAGS) $(TEST_SRC) > /dev/null 2>&1 # DO NOT DELETE testclm.o: ../include/saAis.h ../include/saClm.h