* device/lib/Makefile.in (port-specific-objects-pic16):
authortecodev <tecodev@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 13 Aug 2005 13:06:16 +0000 (13:06 +0000)
committertecodev <tecodev@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 13 Aug 2005 13:06:16 +0000 (13:06 +0000)
  revert to cp $(PORT)/bin/*.* $(PORTDIR)
* device/lib/pic16/Makefile: added .PHONY targets, removed builddir
  dependency
* device/lib/pic16/Makefile.rules: build subdirs before creating
  the library, removed builddir rule, create $(builddir) early in
  recurse rule, use empty recurse rule for leaf directories
* device/lib/pic16/Makefile.subdir: added phony targets, ignore
  mkdir errors (race condition), removed duplicate suffix "hex"
  from clean rules
* device/lib/pic16/libdev/Makefile: recursive make via + and $(MAKE)
* device/lib/pic16/libio/Makefile: create sub-make's builddir early,
  prevents mkdir -p from aborting on Alpha

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3841 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
device/lib/Makefile.in
device/lib/pic16/Makefile
device/lib/pic16/Makefile.rules
device/lib/pic16/Makefile.subdir
device/lib/pic16/libdev/Makefile
device/lib/pic16/libio/Makefile

index 9bcd73e28cd2c1f7faf0b44a07043663abbfefd4..daa90501de598a9b849c110212f32c625f382c05 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2005-08-13 Raphael Neider <rneider AT web.de>
+
+       * device/lib/Makefile.in (port-specific-objects-pic16):
+         revert to cp $(PORT)/bin/*.* $(PORTDIR)
+       * device/lib/pic16/Makefile: added .PHONY targets, removed builddir
+         dependency
+       * device/lib/pic16/Makefile.rules: build subdirs before creating
+         the library, removed builddir rule, create $(builddir) early in
+         recurse rule, use empty recurse rule for leaf directories
+       * device/lib/pic16/Makefile.subdir: added phony targets, ignore
+         mkdir errors (race condition), removed duplicate suffix "hex"
+         from clean rules
+       * device/lib/pic16/libdev/Makefile: recursive make via + and $(MAKE)
+       * device/lib/pic16/libio/Makefile: create sub-make's builddir early,
+         prevents mkdir -p from aborting on Alpha
+       
 2005-08-12 Raphael Neider <rneider AT web.de>
 
        * src/pic16/glue.c (pic16_print(G)PointerType): do not flush
index f88dbf831732456c06855b637ae14ded86cc35db..7465987af74954e91da964358f95063818195a9f 100644 (file)
@@ -258,7 +258,7 @@ port-specific-objects-pic16:
        -if [ -d $(PORT) ]; then \
          mkdir -p $(PORT)/bin; \
          $(MAKE) -C $(PORT); \
-         cp -f $(PORT)/bin/*.o $(PORT)/bin/*.lib $(PORTDIR); \
+         cp -f $(PORT)/bin/*.* $(PORTDIR); \
        fi
 
 lib-files:
index a28c9f7c17b6a11ac1b1d8b074beeeed0d912b3b..002ef2a6e646048eb7004e42690453a5d5473bdd 100644 (file)
@@ -22,6 +22,8 @@ include $(topsrcdir)/Makefile.common
 
 ifeq (:,$(findstring :,$(LD) $(AS) $(LIB)))
 
+.PHONY : all
+
 all % : 
        @echo "gputils not found -- PIC16 library not built!"
 
@@ -36,11 +38,11 @@ C_SRC = $(wildcard *.c)
 S_SRC = $(wildcard *.S)
 OBJS = $(C_SRC:.c=.o) $(S_SRC:.S=.o)
 
-.PHONY : all clean clean-intermediate recurse
+.PHONY : all clean clean-intermediate install
 
 all : install
 
-install : builddir recurse
+install : recurse
 
 clean : recurse
        $(Q)-$(RMDIR) "$(topsrcdir)/$(builddir)";
index e36ebe6bb02b46906d83202e21e3b84ddfeb6d63..42aaef907412ee32a03f83a8c0d3ed1571985224 100644 (file)
@@ -37,22 +37,26 @@ ifneq (,$(strip $(LIB_O)))
        @echo "[  LIB  ] $(patsubst $(topsrcdir)/%,%,$@) <== $(patsubst $(topsrcdir)/$(builddir)/%,%,$^)";
        $(Q)$(RM) "$@"; $(LIB) $(LIBFLAGS) "$@" $^;
 else
-%.lib : force
+%.lib : recurse
        @echo "[  LIB  ] $(patsubst $(topsrcdir)/%,%,$@) <== **/*.o";
        $(Q)$(RM) "$@"; LIB_O=`find "$(topsrcdir)/$(builddir)" -name "*.o"`; [ "x$${LIB_O}" = "x" ] || $(LIB) $(LIBFLAGS) "$@" $${LIB_O};
 endif
 
-.PHONY : builddir recurse force
-
-# create builddir
-builddir : force
-       $(Q)[ -d "$(topsrcdir)/$(builddir)" ] || $(MKDIR) "$(topsrcdir)/$(builddir)";
+.PHONY : recurse force
 
 # build sub-directories
+ifneq (,$(strip $(SUBDIRS)))
 recurse : force
-       $(Q)for DIR in $(SUBDIRS) . ; do \
-               [ "$${DIR}" = "." ] || $(GREP) "^$${ARCH}$$" "$${DIR}.ignore" &> /dev/null || $(MAKE) -C "$${DIR}" builddir="$(builddir)/$${DIR}" $(MAKECMDGOALS) || exit 1; \
+       $(Q)+for DIR in $(SUBDIRS) ; do \
+               $(GREP) "^$${ARCH}$$" "$${DIR}.ignore" &> /dev/null || ( \
+                       [ -d "$(topsrcdir)/$(builddir)/$${DIR}" ] || $(MKDIR) "$(topsrcdir)/$(builddir)/$${DIR}"; \
+                       $(MAKE) -C "$${DIR}" builddir="$(builddir)/$${DIR}" $(MAKECMDGOALS); \
+               ) || exit 1; \
        done
+else
+recurse :
+       @# nothing to do
+endif
 
 # target to force remaking of (seemingly) independent targets
 force :
index 1e97bab1cb0c68491f24f0e95538b5cddca844ad..3ee509cdcc52c99e799fa6c95e319a1d5b5a2575 100644 (file)
@@ -37,29 +37,31 @@ LIB_LIB =
 #TARGETS ?= $(OBJS)
 endif
 
+.PHONY : all install clean clean-intermediate
+
 all : install
 
 ifneq (,$(strip $(TARGETS)))
-# usually install $(LIB_LIB) or $(OBJS)
-install : builddir recurse $(OBJS) $(LIB_LIB)
-       @[ -d "$(topsrcdir)/$(installdir)" ] || $(MKDIR) "$(topsrcdir)/$(installdir)";
+# usually install $(LIB_LIB) or $(OBJS), race condition in "[ -d x ] || mkdir x"
+install : recurse $(OBJS) $(LIB_LIB)
+       @[ -d "$(topsrcdir)/$(installdir)" ] || ( $(MKDIR) "$(topsrcdir)/$(installdir)" || true );
        @echo "[INSTALL] $(patsubst $(topsrcdir)/$(builddir)/%,%,$(TARGETS))";
        $(Q)$(CP) $(TARGETS) "$(topsrcdir)/$(installdir)"
 else
 # used in subdirs like libc/ctype whose files
 # are contained in a parent's library
-install : builddir recurse $(OBJS) $(LIB_LIB)
+install : recurse $(OBJS) $(LIB_LIB)
 endif
 
 clean : recurse
        @-echo "dummy" > .dummy
-       $(Q)-$(RM) .dummy $(foreach suf,asm d p lst hex cod sym hex,$(OBJS:.o=.$(suf)))
+       $(Q)-$(RM) .dummy $(foreach suf,asm d p lst hex cod sym,$(OBJS:.o=.$(suf)))
        @-echo "dummy" > .dummy
        $(Q)-$(RM) .dummy $(OBJS) $(LIB_LIB)
        $(Q)-[ ! -d "$(topsrcdir)/$(builddir)" ] || $(RMDIR) "$(topsrcdir)/$(builddir)"
 
 clean-intermediate : recurse
        @-echo "dummy" > .dummy
-       $(Q)-$(RM) .dummy $(foreach suf,asm d p lst hex cod sym hex,$(OBJS:.o=.$(suf)))
+       $(Q)-$(RM) .dummy $(foreach suf,asm d p lst hex cod sym,$(OBJS:.o=.$(suf)))
        
 include $(topsrcdir)/Makefile.rules
index 804ed151d263605c069424b4cb3e1a8715417fbd..c56128b539431ee64d190fff4ac605486aca4b7c 100644 (file)
@@ -27,9 +27,9 @@ TARGETS = $(OBJS:.o=.lib)
 # [...]/devicelibs would be the default target)
 suball : all
 
-.PHONY : $(topsrcdir)/$(builddir)/device_libs 
+.PHONY : $(topsrcdir)/$(builddir)/device_libs suball
 
 $(topsrcdir)/$(builddir)/device_libs :
-       $(Q)$(foreach dev,$(C_FILES:.c=),make $(topsrcdir)/$(builddir)/$(dev).lib LIB_O=$(topsrcdir)/$(builddir)/$(dev).o;)
+       $(Q)+$(foreach dev,$(C_FILES:.c=),$(MAKE) $(topsrcdir)/$(builddir)/$(dev).lib LIB_O=$(topsrcdir)/$(builddir)/$(dev).o;)
 
 include $(topsrcdir)/Makefile.subdir
index 3c999bc47469121e5df8aca09de4a219df6d6f19..ba199bae49b78a14624e988df5c5cc8b66b9db23 100644 (file)
@@ -23,13 +23,19 @@ SUBDIRS = adc i2c usart
 ifeq ($(origin IO_ARCH),undefined)
 include $(topsrcdir)/Makefile.common
 
-all clean clean-intermediate install : builddir
-       $(Q)cat $(topsrcdir)/pics.build \
+.PHONY : all clean clean-intermediate install
+
+# I create $(builddir)/$${arch} right here in order to prevent 
+# the sub-make's `builddir´ rules from aborting if another sub-make
+# already created the above directory (happened on Alpha).
+all clean clean-intermediate install :
+       $(Q)+cat $(topsrcdir)/pics.build \
                | $(SED) -e "s,[ \t]*#.*$$,," \
                | $(GREP) -v "^[ \t]*$$" \
                | while read arch; do \
                        [ "x$${arch}" = "x" ] \
-                       || MKLIB=libio18f$${arch}.lib $(MAKE) builddir=$(builddir)/$${arch} ARCH=$${arch} IO_ARCH=$${arch} $(MAKECMDGOALS) \
+                       || ( [ -d "$(builddir)/$${arch}" ] || $(MKDIR) "$(builddir)/$${arch}"; \
+                               $(MAKE) MKLIB=libio18f$${arch}.lib builddir=$(builddir)/$${arch} ARCH=$${arch} IO_ARCH=$${arch} $(MAKECMDGOALS); ) \
                        || exit 1; \
        done