11)add -fPIC for $(IPPOOL_RPC_STEM)_xdr.o, $(IPPOOL_RPC_STEM)_client.o 22)add sub target for subdirs-all, and those dependencies below 3 pppd plugin directory build depends on $(IPPOOL_RPC_STEM)_xdr.o 4$(IPPOOL_RPC_STEM)_client.o ippool_rpc.h 5 6 ippoold depends on libusl 7 ippoolconfig depends on libcli 8 9 $(IPPOOL_RPC_STEM)_xdr.o, $(IPPOOL_RPC_STEM)_client.o 10$(IPPOOL_RPC_STEM)_server.o *.o in main directory depends on ippool_rpc.h 11as those all directly or indirectly include ippool_rpc.h which is 12dynamically generated by rpcgen 13 14to make parallel make working. 153)include dependency files for pppd. 16 17Upstream-Status: Pending 18 19Signed-off-by: Yao Zhao <yao.zhao@windriver.com> 20--- 21diff --git a/Makefile b/Makefile 22index 73aa72f..4f7af1d 100644 23--- a/Makefile 24+++ b/Makefile 25@@ -106,14 +106,14 @@ all: generated-files $(IPPOOL_RPC_STEM)_xdr.o $(IPPOOL_RPC_STEM)_client.o \ 26 subdirs-all $(PROGS.sbin) $(PROGS.bin) 27 28 # Compile without -Wall because rpcgen-generated code is full of warnings 29-$(IPPOOL_RPC_STEM)_xdr.o: $(IPPOOL_RPC_STEM)_xdr.c 30- $(CC) -I. -MMD -g -c -w $(CPPFLAGS) $(CFLAGS.optimize) $< 31+$(IPPOOL_RPC_STEM)_xdr.o: $(IPPOOL_RPC_STEM)_xdr.c $(IPPOOL_RPC_STEM).h 32+ $(CC) -I. -MMD -g -c -w $(CPPFLAGS) $(CFLAGS.optimize) $< -fPIC 33 34-$(IPPOOL_RPC_STEM)_client.o: $(IPPOOL_RPC_STEM)_client.c 35- $(CC) -I. -MMD -g -c -w $(CPPFLAGS) $(CFLAGS.optimize) $< 36+$(IPPOOL_RPC_STEM)_client.o: $(IPPOOL_RPC_STEM)_client.c $(IPPOOL_RPC_STEM).h 37+ $(CC) -I. -MMD -g -c -w $(CPPFLAGS) $(CFLAGS.optimize) $< -fPIC 38 39-$(IPPOOL_RPC_STEM)_server.o: $(IPPOOL_RPC_STEM)_server.c 40- $(CC) -I. -MMD -g -c -w $(CPPFLAGS) $(CFLAGS.optimize) $< 41+$(IPPOOL_RPC_STEM)_server.o: $(IPPOOL_RPC_STEM)_server.c $(IPPOOL_RPC_STEM).h 42+ $(CC) -I. -MMD -g -c -w $(CPPFLAGS) $(CFLAGS.optimize) $< -fPIC 43 44 $(IPPOOL_RPC_STEM)_xdr.c: $(IPPOOL_RPC_STEM).x 45 -$(RM) $@ 46@@ -136,8 +136,12 @@ $(IPPOOL_RPC_STEM).h: $(IPPOOL_RPC_STEM).x 47 48 generated-files: $(RPC_FILES) 49 50-subdirs-all: 51- @for d in $(SUBDIRS); do $(MAKE) -C $$d $(MFLAGS) EXTRA_CFLAGS="$(CPPFLAGS)" all; if [ $$? -ne 0 ]; then exit 1; fi; done 52+subdirs-all: $(patsubst %,%-dir, $(SUBDIRS)) 53+ 54+pppd-dir: $(IPPOOL_RPC_STEM)_xdr.o $(IPPOOL_RPC_STEM)_client.o $(IPPOOL_RPC_STEM).h 55+ 56+$(patsubst %,%-dir,$(SUBDIRS)): 57+ @for d in $(patsubst %-dir,%,$@); do $(MAKE) -C $$d $(MFLAGS) EXTRA_CFLAGS="$(CPPFLAGS)" all; if [ $$? -ne 0 ]; then exit 1; fi; done 58 59 clean: 60 @for d in $(SUBDIRS); do $(MAKE) -C $$d $(MFLAGS) $@; if [ $$? -ne 0 ]; then exit 1; fi; done 61@@ -151,13 +155,13 @@ TAGS: 62 @for d in $(SUBDIRS); do $(MAKE) -C $$d $(MFLAGS) $@; done 63 etags -t $(wildcard *.c) $(wildcard *.h) 64 65-ippoold: $(IPPOOLD_SRCS.o) 66- $(CC) -o $@ $^ $(LDFLAGS.ippoold) 67+ippoold: $(IPPOOLD_SRCS.o) usl-dir 68+ $(CC) -o $@ $(IPPOOLD_SRCS.o) $(LDFLAGS.ippoold) 69 70-ippoolconfig: $(IPPOOLCONFIG_SRCS.o) 71- $(CC) -o $@ $^ $(LDFLAGS.ippoolconfig) 72+ippoolconfig: $(IPPOOLCONFIG_SRCS.o) cli-dir 73+ $(CC) -o $@ $(IPPOOLCONFIG_SRCS.o) $(LDFLAGS.ippoolconfig) 74 75-%.o: %.c 76+%.o: %.c $(IPPOOL_RPC_STEM).h 77 $(CC) -c $(CFLAGS) $< -o $@ 78 79 install: all 80diff --git a/pppd/Makefile b/pppd/Makefile 81index 78d9b33..106deca 100644 82--- a/pppd/Makefile 83+++ b/pppd/Makefile 84@@ -24,3 +24,5 @@ install: ippool.so 85 86 clean: 87 -rm -rf *.o *.so 88+ 89+include $(wildcard *.d /dev/null) 90