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
+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
-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:
ifeq (:,$(findstring :,$(LD) $(AS) $(LIB)))
+.PHONY : all
+
all % :
@echo "gputils not found -- PIC16 library not built!"
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)";
@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 :
#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
# [...]/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
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