########################################################### ### Makefile.rules for the SDCC/PIC14 Library ### ### Copyright (C) 2005 by Raphael Neider ### ### The library is currently maintained by ### Raphael Neider ### ### This file may be distributed under the terms of the the ### GNU General Public License (GPL). See GPL for details. ### ### $Id$ ### # update dependencies $(topsrcdir)/$(builddir)/%.d : %.c ifndef SILENT @echo "[ CPP ] ==> $(patsubst $(topsrcdir)/%,%,$@)"; endif $(Q)$(CPP) $(CPPFLAGS) -o "$@" "$<"; # assemble $(topsrcdir)/$(builddir)/%.o : %.S ifndef SILENT @echo "[ AS ] ==> $(patsubst $(topsrcdir)/%,%,$@)"; endif $(Q)$(CPP) $(CPPFLAGS) -P -o "$*.Spp" "$<"; $(Q)$(AS) $(ASFLAGS) -o "$@" -c "$*.Spp"; $(Q)$(RM) "$*.Spp"; # compile $(topsrcdir)/$(builddir)/%.o : %.c ifndef SILENT @echo "[ CC ] ==> $(patsubst $(topsrcdir)/%,%,$@)"; endif $(Q)$(CC) $(CFLAGS) -o "$@" -c "$<"; # create library ifneq (,$(strip $(LIB_O))) %.lib : $(LIB_O) ifndef SILENT @echo "[ LIB ] $(patsubst $(topsrcdir)/%,%,$@) <== $(patsubst $(topsrcdir)/$(builddir)/%,%,$^)"; endif $(Q)$(RM) "$@"; $(LIB) $(LIBFLAGS) "$@" $^; else %.lib : recurse ifndef SILENT @echo "[ LIB ] $(patsubst $(topsrcdir)/%,%,$@) <== **/*.o"; endif $(Q)$(RM) "$@"; LIB_O=`find "$(topsrcdir)/$(builddir)" -name "*.o"`; [ "x$${LIB_O}" = "x" ] || $(LIB) $(LIBFLAGS) "$@" $${LIB_O}; endif .PHONY : recurse force # build sub-directories ifneq (,$(strip $(SUBDIRS))) recurse : force $(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 :