* configure.in: added missing mcs51 in status output
[fw/sdcc] / device / lib / pic16 / Makefile.subdir
1 ###########################################################
2 ### Makefile.subdir for the GNU PIC Library
3 ###
4 ### Copyright (C) 2005 by Raphael Neider <rneider AT web.de>
5 ###
6 ### The GNU PIC Library was originally designed and
7 ### implemented by
8 ###     Vangelis Rokas <vrokas@otenet.gr>
9 ###
10 ### It is currently maintained by
11 ###     Raphael Neider <rneider AT web.de>
12 ###
13 ### This file may be distributed under the terms of the the
14 ### GNU General Public License (GPL). See COPYING for details.
15 ###
16 ### $Id$
17 ###
18
19 include $(top_builddir)/Makefile.common
20
21 SUBDIRS ?= 
22 MKLIB   ?= 
23
24 # fallback: if builddir is not specified via the command line...
25 builddir ?= build/$(patsubst $(shell cd $(top_builddir); pwd)/%,%,$(CURDIR))
26
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))
30 LIB_O   ?= $(OBJS)
31
32 ifneq (,$(strip $(MKLIB)))
33 LIB_LIB = $(top_builddir)/$(builddir)/$(MKLIB)
34 TARGETS ?= $(LIB_LIB)
35 else
36 LIB_LIB = 
37 #TARGETS ?= $(OBJS)
38 endif
39
40 .PHONY : all install clean clean-intermediate
41
42 all : install
43
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)"
48 ifndef SILENT
49         @echo "[INSTALL] $(patsubst $(top_builddir)/$(builddir)/%,%,$(TARGETS))";
50 endif
51         $(Q)$(CP) $(TARGETS) "$(top_builddir)/$(installdir)"
52 else
53 # used in subdirs like libc/ctype whose files
54 # are contained in a parent's library
55 install : recurse $(OBJS) $(LIB_LIB)
56 endif
57
58 clean : recurse
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)"
68
69 distclean : clean
70
71 clean-intermediate : recurse
72         @-echo "dummy" > .dummy
73         $(Q)-$(RM) .dummy $(foreach suf,p lst hex cod sym,$(OBJS:.o=.$(suf)))
74         
75 include $(top_srcdir)/Makefile.rules