1 ###########################################################
2 ### Makefile.subdir for the SDCC/PIC14 Library
4 ### Copyright (C) 2005 by Raphael Neider <rneider AT web.de>
6 ### The library is currently maintained by
7 ### Raphael Neider <rneider AT web.de>
9 ### This file may be distributed under the terms of the the
10 ### GNU General Public License (GPL). See GPL for details.
12 ### $Id: Makefile.subdir 4555 2007-01-03 21:19:58Z bernhardheld $
15 include $(top_builddir)/Makefile.common
20 # fallback: if builddir is not specified via the command line...
21 builddir ?= build/$(patsubst $(shell cd $(top_srcdir); pwd)/%,%,$(CURDIR))
23 C_SRC ?= $(sort $(notdir $(wildcard $(srcdir)/*.c)))
24 S_SRC ?= $(sort $(notdir $(wildcard $(srcdir)/*.S)))
25 OBJS ?= $(addprefix $(top_builddir)/$(builddir)/,$(C_SRC:%.c=%.o) $(S_SRC:%.S=%.o))
29 ifneq (,$(strip $(MKLIB)))
30 LIB_LIB = $(top_builddir)/$(builddir)/$(MKLIB)
37 .PHONY : all install clean clean-intermediate
41 ifneq (,$(strip $(TARGETS)))
42 # usually install $(LIB_LIB) or $(OBJS), race condition in "[ -d x ] || mkdir x"
43 install : recurse $(OBJS) $(LIB_LIB)
44 -@$(MKDIR) "$(top_builddir)/$(installdir)"
46 @echo "[INSTALL] $(patsubst $(top_builddir)/$(builddir)/%,%,$(TARGETS))"
48 $(Q)$(CP) $(TARGETS) "$(top_builddir)/$(installdir)"
50 # used in subdirs like libc/ctype whose files
51 # are contained in a parent's library
52 install : recurse $(OBJS) $(LIB_LIB)
56 @-echo "dummy" > .dummy
57 $(Q)-$(RM) .dummy $(foreach suf,asm d p lst hex cod sym,$(OBJS:.o=.$(suf)))
58 @-echo "dummy" > .dummy
59 $(Q)-$(RM) .dummy $(OBJS) $(LIB_LIB)
61 $(Q)-$(RM) $(addprefix $(top_builddir)/$(installdir)/,$(notdir $(TARGETS)))
62 $(Q)-[ ! -d "$(top_builddir)/$(builddir)" ] || $(RMDIR) "$(top_builddir)/$(builddir)"
67 clean-intermediate : recurse
68 @-echo "dummy" > .dummy
69 $(Q)-$(RM) .dummy $(foreach suf,p lst hex cod sym,$(OBJS:.o=.$(suf)))
71 include $(top_srcdir)/Makefile.rules