diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-03-19 23:40:07 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-03-19 23:40:07 +0000 |
commit | 8a062dae26f2825901035d88dc9cd907f052bade (patch) | |
tree | d878cda8239811cc6d4f7eba91c2d55e553244a4 /nuttx/libc/Makefile | |
parent | a48a83271d371fd33201e3bba10967531ad32419 (diff) | |
download | px4-nuttx-8a062dae26f2825901035d88dc9cd907f052bade.tar.gz px4-nuttx-8a062dae26f2825901035d88dc9cd907f052bade.tar.bz2 px4-nuttx-8a062dae26f2825901035d88dc9cd907f052bade.zip |
Directories where the same source files are used to build different objects need to keep those objects in separate directories; LPC17xx updates from Chris Taglia
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5762 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/libc/Makefile')
-rw-r--r-- | nuttx/libc/Makefile | 69 |
1 files changed, 29 insertions, 40 deletions
diff --git a/nuttx/libc/Makefile b/nuttx/libc/Makefile index f565abb9b..8526f1b0b 100644 --- a/nuttx/libc/Makefile +++ b/nuttx/libc/Makefile @@ -62,74 +62,60 @@ include queue/Make.defs include wqueue/Make.defs include misc/Make.defs -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) +BINDIR ?= bin + +AOBJS = $(patsubst %.S, $(BINDIR)$(DELIM)%$(OBJEXT), $(ASRCS)) +COBJS = $(patsubst %.c, $(BINDIR)$(DELIM)%$(OBJEXT), $(CSRCS)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) UBIN = libuc$(LIBEXT) KBIN = libkc$(LIBEXT) -BIN = libc$(LIBEXT) +BIN ?= libc$(LIBEXT) all: $(BIN) -.PHONY: kclean uclean clean distclean +.PHONY: clean distclean -$(AOBJS): %$(OBJEXT): %.S +$(AOBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.S $(call ASSEMBLE, $<, $@) -$(COBJS): %$(OBJEXT): %.c +$(COBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.c $(call COMPILE, $<, $@) +# C library for the flat build + $(BIN): $(OBJS) $(call ARCHIVE, $@, $(OBJS)) +# C library for the user phase of the two-pass kernel build + ifneq ($(BIN),$(UBIN)) -$(UBIN): kclean - $(Q) $(MAKE) $(UBIN) BIN=$(UBIN) TOPDIR=$(TOPDIR) EXTRADEFINES=$(EXTRADEFINES) - $(Q) touch .userlib +$(UBIN): + $(Q) $(MAKE) $(UBIN) BIN=$(UBIN) BINDIR=ubin TOPDIR=$(TOPDIR) EXTRADEFINES=$(EXTRADEFINES) endif +# C library for the kernel phase of the two-pass kernel build + ifneq ($(BIN),$(KBIN)) -$(KBIN): uclean - $(Q) $(MAKE) $(KBIN) BIN=$(KBIN) TOPDIR=$(TOPDIR) EXTRADEFINES=$(EXTRADEFINES) - $(Q) touch .kernlib +$(KBIN): + $(Q) $(MAKE) $(KBIN) BIN=$(KBIN) BINDIR=kbin TOPDIR=$(TOPDIR) EXTRADEFINES=$(EXTRADEFINES) endif +# Dependencies + .depend: Makefile $(SRCS) $(Q) $(MKDEP) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep $(Q) touch $@ -depend: .depend - -# Clean Targets: -# Clean user-mode temporary files (retaining the UBIN binary) - -uclean: -ifneq ($(OBJEXT),) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - $(Q) if exist .userlib ]; then del *$(OBJEXT) -else - $(Q) ( if [ -f .userlib ]; then rm -f *$(OBJEXT); fi ) -endif -endif - $(call DELFILE, .userlib) - -# Clean kernel-mode temporary files (retaining the KBIN binary) - -kclean: -ifneq ($(OBJEXT),) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - $(Q) if exist .kernlib ]; then del *$(OBJEXT) -else - $(Q) ( if [ -f .kernlib ]; then rm -f *$(OBJEXT); fi ) -endif -endif - $(call DELFILE, .kernlib) +depend: $(BINDIR)$(DELIM).depend -# Really clean everything +# Clean most derived files, retaining the configuration -clean: uclean kclean +clean: + $(Q) $(MAKE) -C bin clean TOPDIR=$(TOPDIR) + $(Q) $(MAKE) -C ubin clean TOPDIR=$(TOPDIR) + $(Q) $(MAKE) -C kbin clean TOPDIR=$(TOPDIR) $(call DELFILE, $(BIN)) $(call DELFILE, $(UBIN)) $(call DELFILE, $(KBIN)) @@ -138,6 +124,9 @@ clean: uclean kclean # Deep clean -- removes all traces of the configuration distclean: clean + $(Q) $(MAKE) -C bin distclean TOPDIR=$(TOPDIR) + $(Q) $(MAKE) -C ubin distclean TOPDIR=$(TOPDIR) + $(Q) $(MAKE) -C kbin distclean TOPDIR=$(TOPDIR) $(call DELFILE, Make.dep) $(call DELFILE, .depend) |