1)add -fPIC for $(IPPOOL_RPC_STEM)_xdr.o, $(IPPOOL_RPC_STEM)_client.o 
 | 
2)add sub target for subdirs-all, and those dependencies below 
 | 
  pppd plugin directory build depends on $(IPPOOL_RPC_STEM)_xdr.o  
 | 
$(IPPOOL_RPC_STEM)_client.o ippool_rpc.h 
 | 
  
 | 
  ippoold depends on libusl 
 | 
  ippoolconfig depends on libcli 
 | 
  
 | 
  $(IPPOOL_RPC_STEM)_xdr.o, $(IPPOOL_RPC_STEM)_client.o  
 | 
$(IPPOOL_RPC_STEM)_server.o *.o in main directory depends on ippool_rpc.h 
 | 
as those all directly or indirectly include ippool_rpc.h which is  
 | 
dynamically generated by rpcgen 
 | 
  
 | 
to make parallel make working. 
 | 
3)include dependency files for pppd. 
 | 
  
 | 
Upstream-Status: Pending 
 | 
  
 | 
Signed-off-by: Yao Zhao <yao.zhao@windriver.com> 
 | 
--- 
 | 
diff --git a/Makefile b/Makefile 
 | 
index 73aa72f..4f7af1d 100644 
 | 
--- a/Makefile 
 | 
+++ b/Makefile 
 | 
@@ -106,14 +106,14 @@ all:            generated-files $(IPPOOL_RPC_STEM)_xdr.o $(IPPOOL_RPC_STEM)_client.o \ 
 | 
             subdirs-all $(PROGS.sbin) $(PROGS.bin) 
 | 
  
 | 
 # Compile without -Wall because rpcgen-generated code is full of warnings 
 | 
-$(IPPOOL_RPC_STEM)_xdr.o:    $(IPPOOL_RPC_STEM)_xdr.c 
 | 
-            $(CC) -I. -MMD -g -c -w $(CPPFLAGS) $(CFLAGS.optimize) $< 
 | 
+$(IPPOOL_RPC_STEM)_xdr.o:    $(IPPOOL_RPC_STEM)_xdr.c $(IPPOOL_RPC_STEM).h 
 | 
+            $(CC) -I. -MMD -g -c -w $(CPPFLAGS) $(CFLAGS.optimize) $< -fPIC 
 | 
  
 | 
-$(IPPOOL_RPC_STEM)_client.o:    $(IPPOOL_RPC_STEM)_client.c 
 | 
-            $(CC) -I. -MMD -g -c -w $(CPPFLAGS) $(CFLAGS.optimize) $< 
 | 
+$(IPPOOL_RPC_STEM)_client.o:    $(IPPOOL_RPC_STEM)_client.c $(IPPOOL_RPC_STEM).h 
 | 
+            $(CC) -I. -MMD -g -c -w $(CPPFLAGS) $(CFLAGS.optimize) $< -fPIC 
 | 
  
 | 
-$(IPPOOL_RPC_STEM)_server.o:    $(IPPOOL_RPC_STEM)_server.c 
 | 
-            $(CC) -I. -MMD -g -c -w $(CPPFLAGS) $(CFLAGS.optimize) $< 
 | 
+$(IPPOOL_RPC_STEM)_server.o:    $(IPPOOL_RPC_STEM)_server.c $(IPPOOL_RPC_STEM).h 
 | 
+            $(CC) -I. -MMD -g -c -w $(CPPFLAGS) $(CFLAGS.optimize) $< -fPIC 
 | 
  
 | 
 $(IPPOOL_RPC_STEM)_xdr.c:    $(IPPOOL_RPC_STEM).x 
 | 
             -$(RM) $@ 
 | 
@@ -136,8 +136,12 @@ $(IPPOOL_RPC_STEM).h:    $(IPPOOL_RPC_STEM).x 
 | 
  
 | 
 generated-files:    $(RPC_FILES) 
 | 
  
 | 
-subdirs-all: 
 | 
-            @for d in $(SUBDIRS); do $(MAKE) -C $$d $(MFLAGS) EXTRA_CFLAGS="$(CPPFLAGS)" all; if [ $$? -ne 0 ]; then exit 1; fi; done 
 | 
+subdirs-all:    $(patsubst %,%-dir, $(SUBDIRS)) 
 | 
+ 
 | 
+pppd-dir: $(IPPOOL_RPC_STEM)_xdr.o $(IPPOOL_RPC_STEM)_client.o $(IPPOOL_RPC_STEM).h 
 | 
+ 
 | 
+$(patsubst %,%-dir,$(SUBDIRS)): 
 | 
+            @for d in $(patsubst %-dir,%,$@); do $(MAKE) -C $$d $(MFLAGS) EXTRA_CFLAGS="$(CPPFLAGS)" all; if [ $$? -ne 0 ]; then exit 1; fi; done 
 | 
  
 | 
 clean: 
 | 
             @for d in $(SUBDIRS); do $(MAKE) -C $$d $(MFLAGS) $@; if [ $$? -ne 0 ]; then exit 1; fi; done 
 | 
@@ -151,13 +155,13 @@ TAGS: 
 | 
             @for d in $(SUBDIRS); do $(MAKE) -C $$d $(MFLAGS) $@; done 
 | 
             etags -t $(wildcard *.c) $(wildcard *.h) 
 | 
  
 | 
-ippoold:        $(IPPOOLD_SRCS.o) 
 | 
-            $(CC) -o $@ $^ $(LDFLAGS.ippoold) 
 | 
+ippoold:        $(IPPOOLD_SRCS.o) usl-dir 
 | 
+            $(CC) -o $@ $(IPPOOLD_SRCS.o) $(LDFLAGS.ippoold) 
 | 
  
 | 
-ippoolconfig:        $(IPPOOLCONFIG_SRCS.o) 
 | 
-            $(CC) -o $@ $^ $(LDFLAGS.ippoolconfig) 
 | 
+ippoolconfig:        $(IPPOOLCONFIG_SRCS.o) cli-dir 
 | 
+            $(CC) -o $@ $(IPPOOLCONFIG_SRCS.o) $(LDFLAGS.ippoolconfig) 
 | 
  
 | 
-%.o:    %.c 
 | 
+%.o:    %.c $(IPPOOL_RPC_STEM).h 
 | 
             $(CC) -c $(CFLAGS) $< -o $@ 
 | 
  
 | 
 install:        all 
 | 
diff --git a/pppd/Makefile b/pppd/Makefile 
 | 
index 78d9b33..106deca 100644 
 | 
--- a/pppd/Makefile 
 | 
+++ b/pppd/Makefile 
 | 
@@ -24,3 +24,5 @@ install: ippool.so 
 | 
  
 | 
 clean: 
 | 
     -rm -rf *.o *.so 
 | 
+ 
 | 
+include $(wildcard *.d /dev/null) 
 |