X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=device%2Flib%2Fpic%2FMakefile.subdir;h=f771dc06fb287f57355687b98fbfe427bc1d0817;hb=c42e9051755428d14eb620abc9eda86d43479a1a;hp=1d228e3790deac08edf981a5e29efe2b36d22604;hpb=5979bbd157a5f3cd8018aed666e4dd41a3e08edf;p=fw%2Fsdcc diff --git a/device/lib/pic/Makefile.subdir b/device/lib/pic/Makefile.subdir index 1d228e37..f771dc06 100644 --- a/device/lib/pic/Makefile.subdir +++ b/device/lib/pic/Makefile.subdir @@ -12,21 +12,22 @@ ### $Id$ ### -include $(topsrcdir)/Makefile.common +include $(top_builddir)Makefile.common SUBDIRS ?= MKLIB ?= # fallback: if builddir is not specified via the command line... -builddir ?= build/$(patsubst $(shell cd $(topsrcdir); pwd)/%,%,$(CURDIR)) +builddir ?= build/$(patsubst $(shell cd $(top_srcdir); 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)) -C_SRC ?= $(wildcard *.c) -S_SRC ?= $(wildcard *.S) -OBJS ?= $(addprefix $(topsrcdir)/$(builddir)/,$(C_SRC:.c=.o) $(S_SRC:.S=.o)) LIB_O ?= $(OBJS) ifneq (,$(strip $(MKLIB))) -LIB_LIB = $(topsrcdir)/$(builddir)/$(MKLIB) +LIB_LIB = $(top_builddir)$(builddir)/$(MKLIB) TARGETS ?= $(LIB_LIB) else LIB_LIB = @@ -40,11 +41,11 @@ all : install ifneq (,$(strip $(TARGETS))) # usually install $(LIB_LIB) or $(OBJS), race condition in "[ -d x ] || mkdir x" install : recurse $(OBJS) $(LIB_LIB) - @[ -d "$(topsrcdir)/$(installdir)" ] || ( $(MKDIR) "$(topsrcdir)/$(installdir)" || true ); + -@$(MKDIR) "$(top_builddir)$(installdir)" ifndef SILENT - @echo "[INSTALL] $(patsubst $(topsrcdir)/$(builddir)/%,%,$(TARGETS))"; + @echo "[INSTALL] $(patsubst $(top_builddir)$(builddir)/%,%,$(TARGETS))" endif - $(Q)$(CP) $(TARGETS) "$(topsrcdir)/$(installdir)" + $(Q)$(CP) $(TARGETS) "$(top_builddir)$(installdir)" else # used in subdirs like libc/ctype whose files # are contained in a parent's library @@ -57,11 +58,11 @@ clean : recurse @-echo "dummy" > .dummy $(Q)-$(RM) .dummy $(OBJS) $(LIB_LIB) $(Q)-$(RM) $(TARGETS) - $(Q)-$(RM) $(addprefix $(topsrcdir)/$(installdir)/,$(notdir $(TARGETS))) - $(Q)-[ ! -d "$(topsrcdir)/$(builddir)" ] || $(RMDIR) "$(topsrcdir)/$(builddir)" + $(Q)-$(RM) $(addprefix $(top_builddir)$(installdir)/,$(notdir $(TARGETS))) + $(Q)-[ ! -d "$(top_builddir)$(builddir)" ] || $(RMDIR) "$(top_builddir)$(builddir)" clean-intermediate : recurse @-echo "dummy" > .dummy $(Q)-$(RM) .dummy $(foreach suf,p lst hex cod sym,$(OBJS:.o=.$(suf))) -include $(topsrcdir)/Makefile.rules +include $(top_srcdir)/Makefile.rules