summaryrefslogtreecommitdiff
path: root/nuttx/libc
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-03-19 23:40:07 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-03-19 23:40:07 +0000
commit8a062dae26f2825901035d88dc9cd907f052bade (patch)
treed878cda8239811cc6d4f7eba91c2d55e553244a4 /nuttx/libc
parenta48a83271d371fd33201e3bba10967531ad32419 (diff)
downloadpx4-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')
-rw-r--r--nuttx/libc/Makefile69
-rw-r--r--nuttx/libc/bin/Makefile48
-rw-r--r--nuttx/libc/kbin/Makefile48
-rw-r--r--nuttx/libc/ubin/Makefile48
4 files changed, 173 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)
diff --git a/nuttx/libc/bin/Makefile b/nuttx/libc/bin/Makefile
new file mode 100644
index 000000000..3f8b21f12
--- /dev/null
+++ b/nuttx/libc/bin/Makefile
@@ -0,0 +1,48 @@
+############################################################################
+# libc/bin/Makefile
+#
+# Copyright (C) 2013 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+###########################################################################
+
+-include $(TOPDIR)/Make.defs
+
+all:
+.PHONY: clean distclean
+
+# Clean Targets:
+
+clean:
+ $(call CLEAN)
+
+# Deep clean -- removes all traces of the configuration
+
+distclean: clean
diff --git a/nuttx/libc/kbin/Makefile b/nuttx/libc/kbin/Makefile
new file mode 100644
index 000000000..3ab92a30a
--- /dev/null
+++ b/nuttx/libc/kbin/Makefile
@@ -0,0 +1,48 @@
+############################################################################
+# libc/kbin/Makefile
+#
+# Copyright (C) 2013 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+###########################################################################
+
+-include $(TOPDIR)/Make.defs
+
+all:
+.PHONY: clean distclean
+
+# Clean Targets:
+
+clean:
+ $(call CLEAN)
+
+# Deep clean -- removes all traces of the configuration
+
+distclean: clean
diff --git a/nuttx/libc/ubin/Makefile b/nuttx/libc/ubin/Makefile
new file mode 100644
index 000000000..aca00c703
--- /dev/null
+++ b/nuttx/libc/ubin/Makefile
@@ -0,0 +1,48 @@
+############################################################################
+# libc/ubin/Makefile
+#
+# Copyright (C) 2013 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <gnutt@nuttx.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+###########################################################################
+
+-include $(TOPDIR)/Make.defs
+
+all:
+.PHONY: clean distclean
+
+# Clean Targets:
+
+clean:
+ $(call CLEAN)
+
+# Deep clean -- removes all traces of the configuration
+
+distclean: clean