* src/pic16/gen.c (genCast): fixed typo
[fw/sdcc] / device / lib / pic16 / Makefile.subdir
index 63952b1dc93cb299ac3b40ec8bd3b985b7fc5034..eb4a8be9148383315c539d2d46db57aa5352c433 100644 (file)
@@ -1,14 +1,14 @@
 ###########################################################
 ### Makefile.subdir for the GNU PIC Library
 ###
-### Copyright (C) 2005 by Raphael Neider <rneider@web.de>
+### Copyright (C) 2005 by Raphael Neider <rneider AT web.de>
 ###
 ### The GNU PIC Library was originally designed and
 ### implemented by
 ###    Vangelis Rokas <vrokas@otenet.gr>
 ###
 ### It is currently maintained by
-###    Raphael Neider <rneider@web.de>
+###    Raphael Neider <rneider AT web.de>
 ###
 ### This file may be distributed under the terms of the the
 ### GNU General Public License (GPL). See COPYING for details.
@@ -16,7 +16,7 @@
 ### $Id$
 ###
 
-include $(top_builddir)Makefile.common
+include $(top_builddir)/Makefile.common
 
 SUBDIRS ?= 
 MKLIB  ?= 
@@ -26,29 +26,38 @@ builddir ?= build/$(patsubst $(shell cd $(top_builddir); pwd)/%,%,$(CURDIR))
 
 C_SRC  ?= $(notdir $(wildcard $(srcdir)/*.c))
 S_SRC  ?= $(notdir $(wildcard $(srcdir)/*.S))
-OBJS   ?= $(addprefix $(top_builddir)$(builddir)/,$(C_SRC:.c=.o) $(S_SRC:.S=.o))
+OBJS   ?= $(addprefix $(top_builddir)/$(builddir)/,$(C_SRC:.c=.o) $(S_SRC:.S=.o))
 LIB_O  ?= $(OBJS)
 
 ifneq (,$(strip $(MKLIB)))
-LIB_LIB = $(top_builddir)$(builddir)/$(MKLIB)
+LIB_LIB = $(top_builddir)/$(builddir)/$(MKLIB)
 TARGETS ?= $(LIB_LIB)
 else
 LIB_LIB = 
 #TARGETS ?= $(OBJS)
 endif
 
-.PHONY : all install clean clean-intermediate
+.PHONY : all install clean clean-intermediate $(addprefix install,$(TARGETS))
+
+ifndef SILENT
+ECHO=echo
+else
+ECHO=true
+endif
 
 all : install
 
 ifneq (,$(strip $(TARGETS)))
+
+$(addprefix install,$(TARGETS)): install% : %
+       @-if [ -e "$<" ]; then \
+       [ -d "$(top_builddir)/$(installdir)" ] || $(MKDIR) "$(top_builddir)/$(installdir)"; \
+       $(ECHO) "[INSTALL] $(patsubst $(top_builddir)/$(builddir)/%,%,$<)"; \
+       [ ! -e "$<" ] || $(CP) "$<" "$(top_builddir)/$(installdir)"; \
+       fi
+
 # usually install $(LIB_LIB) or $(OBJS), race condition in "[ -d x ] || mkdir x"
-install : recurse $(OBJS) $(LIB_LIB)
-       @$(MKDIR) "$(top_builddir)$(installdir)"
-ifndef SILENT
-       @echo "[INSTALL] $(patsubst $(top_builddir)$(builddir)/%,%,$(TARGETS))";
-endif
-       $(Q)$(CP) $(TARGETS) "$(top_builddir)$(installdir)"
+install : recurse $(OBJS) $(LIB_LIB) $(addprefix install,$(TARGETS))
 else
 # used in subdirs like libc/ctype whose files
 # are contained in a parent's library
@@ -63,8 +72,10 @@ clean : recurse
        @-echo "dummy" > .dummy
        $(Q)-$(RM) .dummy $(TARGETS)
        @-echo "dummy" > .dummy
-       $(Q)-$(RM) .dummy $(addprefix $(top_builddir)$(installdir)/,$(notdir $(TARGETS)))
-       $(Q)-[ ! -d "$(top_builddir)$(builddir)" ] || $(RMDIR) "$(top_builddir)$(builddir)"
+       $(Q)-$(RM) .dummy $(addprefix $(top_builddir)/$(installdir)/,$(notdir $(TARGETS)))
+       $(Q)-[ ! -d "$(top_builddir)/$(builddir)" ] || $(RMDIR) "$(top_builddir)/$(builddir)"
+
+distclean : clean
 
 clean-intermediate : recurse
        @-echo "dummy" > .dummy