1 ###########################################################
2 ### Makefile.subdir for the GNU PIC Library
4 ### Copyright (C) 2005 by Raphael Neider <rneider AT web.de>
6 ### The GNU PIC Library was originally designed and
8 ### Vangelis Rokas <vrokas@otenet.gr>
10 ### It is currently maintained by
11 ### Raphael Neider <rneider AT web.de>
13 ### This file may be distributed under the terms of the the
14 ### GNU General Public License (GPL). See COPYING for details.
19 include $(top_builddir)Makefile.common
24 # fallback: if builddir is not specified via the command line...
25 builddir ?= build/$(patsubst $(shell cd $(top_builddir); pwd)/%,%,$(CURDIR))
27 C_SRC ?= $(notdir $(wildcard $(srcdir)/*.c))
28 S_SRC ?= $(notdir $(wildcard $(srcdir)/*.S))
29 OBJS ?= $(addprefix $(top_builddir)$(builddir)/,$(C_SRC:.c=.o) $(S_SRC:.S=.o))
32 ifneq (,$(strip $(MKLIB)))
33 LIB_LIB = $(top_builddir)$(builddir)/$(MKLIB)
40 .PHONY : all install clean clean-intermediate
44 ifneq (,$(strip $(TARGETS)))
45 # usually install $(LIB_LIB) or $(OBJS), race condition in "[ -d x ] || mkdir x"
46 install : recurse $(OBJS) $(LIB_LIB)
47 @$(MKDIR) "$(top_builddir)$(installdir)"
49 @echo "[INSTALL] $(patsubst $(top_builddir)$(builddir)/%,%,$(TARGETS))";
51 $(Q)$(CP) $(TARGETS) "$(top_builddir)$(installdir)"
53 # used in subdirs like libc/ctype whose files
54 # are contained in a parent's library
55 install : recurse $(OBJS) $(LIB_LIB)
59 @-echo "dummy" > .dummy
60 $(Q)-$(RM) .dummy $(foreach suf,asm d p lst hex cod sym,$(OBJS:.o=.$(suf)))
61 @-echo "dummy" > .dummy
62 $(Q)-$(RM) .dummy $(OBJS) $(LIB_LIB)
63 @-echo "dummy" > .dummy
64 $(Q)-$(RM) .dummy $(TARGETS)
65 @-echo "dummy" > .dummy
66 $(Q)-$(RM) .dummy $(addprefix $(top_builddir)$(installdir)/,$(notdir $(TARGETS)))
67 $(Q)-[ ! -d "$(top_builddir)$(builddir)" ] || $(RMDIR) "$(top_builddir)$(builddir)"
71 clean-intermediate : recurse
72 @-echo "dummy" > .dummy
73 $(Q)-$(RM) .dummy $(foreach suf,p lst hex cod sym,$(OBJS:.o=.$(suf)))
75 include $(top_srcdir)/Makefile.rules