fix directory creation mechanism; the optimized version would not work :-(
authorAlexandre Oliva <oliva@samba.org>
Tue, 29 Sep 1998 05:16:20 +0000 (05:16 +0000)
committerAlexandre Oliva <oliva@samba.org>
Tue, 29 Sep 1998 05:16:20 +0000 (05:16 +0000)
source/Makefile.in

index 1518d0abef689324b5361c01b60b2608ce5eab2d..ff69a5e641a83dbecbebf3c9a99dece6e88aaa68 100644 (file)
@@ -222,91 +222,110 @@ all : CHECK $(SPROGS) $(PROGS)
 CHECK:
        @echo "Using FLAGS = $(FLAGS)"
        @echo "Using LIBS = $(LIBS)"
-
-.PHONY: obj-dirs
-obj-dirs:
-       @(cd $(srcdir) && ls -1d */*.c) | sed 's,/[^/]*$$,,;s,^$$,.,' | \
+       @(cd $(srcdir) && ls -1d */*.c && echo bin/.) | \
+        sed 's,/[^/]*$$,,;s,^$$,.,' | \
         while read dir; do \
-          if test ! -d "$$dir"; then mkdir "$$dir" || true; else true; fi; \
+          if test ! -d "$$dir"; then \
+            echo mkdir "$$dir" && mkdir "$$dir" || true; \
+          else true; fi; \
         done
 
 .c.o: @MAINT@ .deps/.dummy obj-dirs
        @echo Compiling $*.c
+       @dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` && \
+          if test ! -d "$$dir"; then \
+            echo mkdir "$$dir" && mkdir "$$dir" || true; \
+          else true; fi
        @$(CC) -I. -I$(srcdir) $(FLAGS) -c $< -o $@ \
        @MAINT@ -Wp,-MD,.deps/`echo $* | sed s,/,_,g`.P && : >.deps/.stamp
 # the line above is for atomatic dependency tracking
 # it will only work with GNU make, gcc and --enable-maintainer-mode
 
-.PHONY: bin-dir
-bin-dir:
-       @if test ! -d bin; then mkdir bin || true; else true; fi
+MKDIR_BIN = if test ! -d bin; then echo mkdir bin && mkdir bin || true; else true; fi
 
-bin/smbd: $(SMBD_OBJ) bin-dir
+bin/smbd: $(SMBD_OBJ)
        @echo Linking $@
+       @$(MKDIR_BIN)
        @$(CC) $(FLAGS) -o $@ $(SMBD_OBJ) $(LDFLAGS) $(LIBS) 
 
-bin/nmbd: $(NMBD_OBJ) bin-dir
+bin/nmbd: $(NMBD_OBJ)
        @echo Linking $@
+       @$(MKDIR_BIN)
        @$(CC) $(FLAGS) -o $@ $(NMBD_OBJ) $(LDFLAGS) $(LIBS)
 
-bin/swat: $(SWAT_OBJ) bin-dir
+bin/swat: $(SWAT_OBJ)
        @echo Linking $@
+       @$(MKDIR_BIN)
        @$(CC) $(FLAGS) -o $@ $(SWAT_OBJ) $(LDFLAGS) $(LIBS) 
 
-bin/smbrun: $(SMBRUN_OBJ) bin-dir
+bin/smbrun: $(SMBRUN_OBJ)
        @echo Linking $@
+       @$(MKDIR_BIN)
        @$(CC) $(FLAGS) -o $@ $(SMBRUN_OBJ) $(LDFLAGS) $(LIBS)
 
-bin/rpcclient: $(RPCCLIENT_OBJ) bin-dir
+bin/rpcclient: $(RPCCLIENT_OBJ)
        @echo Linking $@
+       @$(MKDIR_BIN)
        @$(CC) $(FLAGS) -o $@ $(RPCCLIENT_OBJ) $(LDFLAGS) $(LIBS)
 
-bin/smbclient: $(CLIENT_OBJ) bin-dir
+bin/smbclient: $(CLIENT_OBJ)
        @echo Linking $@
+       @$(MKDIR_BIN)
        @$(CC) $(FLAGS) -o $@ $(CLIENT_OBJ) $(LDFLAGS) $(LIBS)
 
-bin/smbmount: $(MOUNT_OBJ) bin-dir
+bin/smbmount: $(MOUNT_OBJ)
        @echo Linking $@
+       @$(MKDIR_BIN)
        @$(CC) $(FLAGS) -o $@ $(MOUNT_OBJ) $(LIBS)
 
-bin/smbmnt: $(MNT_OBJ) bin-dir
+bin/smbmnt: $(MNT_OBJ)
        @echo Linking $@
+       @$(MKDIR_BIN)
        @$(CC) $(FLAGS) -o $@ $(MNT_OBJ) $(LIBS)
 
-bin/smbumount: $(UMOUNT_OBJ) bin-dir
+bin/smbumount: $(UMOUNT_OBJ)
        @echo Linking $@
+       @$(MKDIR_BIN)
        @$(CC) $(FLAGS) -o $@ $(UMOUNT_OBJ) $(LIBS)
 
-bin/testparm: $(TESTPARM_OBJ) bin-dir
+bin/testparm: $(TESTPARM_OBJ)
        @echo Linking $@
+       @$(MKDIR_BIN)
        @$(CC) $(FLAGS) -o $@ $(TESTPARM_OBJ) $(LDFLAGS) $(LIBS)
 
-bin/testprns: $(TESTPRNS_OBJ) bin-dir
+bin/testprns: $(TESTPRNS_OBJ)
        @echo Linking $@
+       @$(MKDIR_BIN)
        @$(CC) $(FLAGS) -o $@ $(TESTPRNS_OBJ) $(LDFLAGS) $(LIBS)
 
-bin/smbstatus: $(STATUS_OBJ) bin-dir
+bin/smbstatus: $(STATUS_OBJ)
        @echo Linking $@
+       @$(MKDIR_BIN)
        @$(CC) $(FLAGS) -o $@ $(STATUS_OBJ) $(LDFLAGS) $(LIBS)
 
-bin/smbpasswd: $(SMBPASSWD_OBJ) bin-dir
+bin/smbpasswd: $(SMBPASSWD_OBJ)
        @echo Linking $@
+       @$(MKDIR_BIN)
        @$(CC) $(FLAGS) -o $@ $(SMBPASSWD_OBJ) $(LDFLAGS) $(LIBS)
 
-bin/make_smbcodepage: $(MAKE_SMBCODEPAGE_OBJ) bin-dir
+bin/make_smbcodepage: $(MAKE_SMBCODEPAGE_OBJ)
        @echo Linking $@
+       @$(MKDIR_BIN)
        @$(CC) $(FLAGS) -o $@ $(MAKE_SMBCODEPAGE_OBJ) $(LDFLAGS) $(LIBS)
 
-bin/nmblookup: $(NMBLOOKUP_OBJ) bin-dir
+bin/nmblookup: $(NMBLOOKUP_OBJ)
        @echo Linking $@
+       @$(MKDIR_BIN)
        @$(CC) $(FLAGS) -o $@ $(NMBLOOKUP_OBJ) $(LDFLAGS) $(LIBS)
 
-bin/make_printerdef: $(MAKE_PRINTERDEF_OBJ) bin-dir
+bin/make_printerdef: $(MAKE_PRINTERDEF_OBJ)
        @echo Linking $@
+       @$(MKDIR_BIN)
        @$(CC) $(FLAGS) -o $@ $(MAKE_PRINTERDEF_OBJ) $(LDFLAGS) $(LIBS)
 
-bin/smbtorture: $(SMBTORTURE_OBJ) bin-dir
+bin/smbtorture: $(SMBTORTURE_OBJ)
        @echo Linking $@
+       @$(MKDIR_BIN)
        @$(CC) $(FLAGS) -o $@ $(SMBTORTURE_OBJ) $(LDFLAGS) $(LIBS)