2007-09-02 17:32:03 +02:00
|
|
|
############################################################################
|
2007-11-18 15:32:06 +01:00
|
|
|
# lib/Makefile
|
2007-02-18 00:21:28 +01:00
|
|
|
#
|
2011-03-30 21:51:19 +02:00
|
|
|
# Copyright (C) 2007-2011 Gregory Nutt. All rights reserved.
|
2007-02-18 00:21:28 +01:00
|
|
|
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
|
|
|
#
|
|
|
|
# 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.
|
2007-09-02 17:32:03 +02:00
|
|
|
# 3. Neither the name NuttX nor the names of its contributors may be
|
2007-02-18 00:21:28 +01:00
|
|
|
# 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.
|
|
|
|
#
|
2007-09-02 17:32:03 +02:00
|
|
|
###########################################################################
|
2007-02-18 00:21:28 +01:00
|
|
|
|
|
|
|
-include $(TOPDIR)/Make.defs
|
2011-03-30 22:34:21 +02:00
|
|
|
include stdio/Make.defs
|
2011-03-30 23:15:57 +02:00
|
|
|
include stdlib/Make.defs
|
2011-03-30 23:58:17 +02:00
|
|
|
include unistd/Make.defs
|
2011-04-02 03:23:08 +02:00
|
|
|
include sched/Make.defs
|
2011-03-30 21:51:19 +02:00
|
|
|
include string/Make.defs
|
2011-03-31 03:42:50 +02:00
|
|
|
include pthread/Make.defs
|
|
|
|
include semaphore/Make.defs
|
2011-04-02 17:25:22 +02:00
|
|
|
include signal/Make.defs
|
2011-04-02 03:23:08 +02:00
|
|
|
include mqueue/Make.defs
|
2011-03-30 23:58:17 +02:00
|
|
|
include math/Make.defs
|
|
|
|
include net/Make.defs
|
2011-03-30 23:15:57 +02:00
|
|
|
include time/Make.defs
|
2011-03-31 00:17:36 +02:00
|
|
|
include libgen/Make.defs
|
2011-03-30 23:15:57 +02:00
|
|
|
include queue/Make.defs
|
2011-03-31 00:17:36 +02:00
|
|
|
include misc/Make.defs
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2011-03-30 21:51:19 +02:00
|
|
|
ASRCS =
|
|
|
|
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2011-04-02 03:23:08 +02:00
|
|
|
CSRCS = $(STDIO_SRCS) $(STDLIB_SRCS) $(UNISTD_SRCS) $(SCHED_SRCS) \
|
2011-04-02 17:25:22 +02:00
|
|
|
$(STRING_SRCS) $(PTHREAD_SRCS) $(SEM_SRCS) $(SIG_SRCS) $(MQUEUE_SRCS) \
|
2011-04-02 03:23:08 +02:00
|
|
|
$(MATH_SRCS) $(NET_SRCS) $(TIME_SRCS) $(LIBGEN_SRCS) \
|
|
|
|
$(QUEUE_SRCS) $(MISC_SRCS) $(REGEX_SRCS) $(CRC_SRCS) $(DBG_SRCS)
|
2011-03-30 21:51:19 +02:00
|
|
|
COBJS = $(CSRCS:.c=$(OBJEXT))
|
|
|
|
|
|
|
|
SRCS = $(ASRCS) $(CSRCS)
|
|
|
|
OBJS = $(AOBJS) $(COBJS)
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2011-03-30 21:51:19 +02:00
|
|
|
ROOTDEPPATH = --dep-path .
|
2011-03-30 22:34:21 +02:00
|
|
|
STDIODEPPATH = --dep-path stdio
|
2011-03-30 23:15:57 +02:00
|
|
|
STDLIBDEPPATH = --dep-path stdlib
|
2011-03-30 23:58:17 +02:00
|
|
|
UNISTDDEPPATH = --dep-path unistd
|
2011-04-02 03:23:08 +02:00
|
|
|
SCHEDDEPPATH = --dep-path sched
|
2011-03-30 21:51:19 +02:00
|
|
|
STRINGDEPPATH = --dep-path string
|
2011-03-31 03:42:50 +02:00
|
|
|
PTHREADDEPPATH = --dep-path pthread
|
|
|
|
SEMDEPPATH = --dep-path semaphore
|
2011-04-02 17:25:22 +02:00
|
|
|
SIGDEPPATH = --dep-path signal
|
2011-04-02 03:23:08 +02:00
|
|
|
MQDEPPATH = --dep-path mqueue
|
2011-03-30 23:58:17 +02:00
|
|
|
MATHDEPPATH = --dep-path math
|
|
|
|
NETDEPPATH = --dep-path net
|
2011-03-30 23:15:57 +02:00
|
|
|
TIMEDEPPATH = --dep-path time
|
2011-03-31 00:17:36 +02:00
|
|
|
LIBGENDEPPATH = --dep-path libgen
|
2011-03-30 23:15:57 +02:00
|
|
|
QUEUEDEPPATH = --dep-path queue
|
2011-03-31 00:17:36 +02:00
|
|
|
MISCDEPPATH = --dep-path misc
|
2011-04-02 17:25:22 +02:00
|
|
|
VPATH = stdio:stdlib:unistd:sched:string:pthread:semaphore:signal:mqueue:math:net:time:libgen:queue:misc
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2011-04-05 22:54:00 +02:00
|
|
|
UBIN = libulib$(LIBEXT)
|
|
|
|
KBIN = libklib$(LIBEXT)
|
|
|
|
BIN = liblib$(LIBEXT)
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2011-03-30 21:51:19 +02:00
|
|
|
all: $(BIN)
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2007-02-28 00:59:20 +01:00
|
|
|
$(AOBJS): %$(OBJEXT): %.S
|
2008-01-08 18:06:21 +01:00
|
|
|
$(call ASSEMBLE, $<, $@)
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2007-02-28 00:59:20 +01:00
|
|
|
$(COBJS): %$(OBJEXT): %.c
|
2008-01-08 18:06:21 +01:00
|
|
|
$(call COMPILE, $<, $@)
|
2007-02-18 00:21:28 +01:00
|
|
|
|
|
|
|
$(BIN): $(OBJS)
|
2008-01-08 14:02:47 +01:00
|
|
|
@( for obj in $(OBJS) ; do \
|
2008-01-08 18:06:21 +01:00
|
|
|
$(call ARCHIVE, $@, $${obj}); \
|
2007-02-21 22:55:16 +01:00
|
|
|
done ; )
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2011-04-05 22:54:00 +02:00
|
|
|
ifneq ($(BIN),$(UBIN))
|
|
|
|
.userlib:
|
|
|
|
@$(MAKE) $(UBIN) BIN=$(UBIN) TOPDIR=$(TOPDIR) EXTRADEFINES=$(EXTRADEFINES)
|
|
|
|
@touch .userlib
|
|
|
|
|
|
|
|
$(UBIN): kclean .userlib
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(BIN),$(KBIN))
|
|
|
|
.kernlib:
|
|
|
|
@$(MAKE) $(KBIN) BIN=$(KBIN) TOPDIR=$(TOPDIR) EXTRADEFINES=$(EXTRADEFINES)
|
|
|
|
@touch .kernlib
|
|
|
|
|
|
|
|
$(KBIN): uclean .kernlib
|
|
|
|
endif
|
|
|
|
|
2007-02-18 00:21:28 +01:00
|
|
|
.depend: Makefile $(SRCS)
|
2011-03-30 23:15:57 +02:00
|
|
|
@$(MKDEP) $(ROOTDEPPATH) $(STDIODEPPATH) $(STDLIBDEPPATH) \
|
2011-04-02 03:23:08 +02:00
|
|
|
$(UNISTDDEPPATH) $(SCHEDDEPPATH) $(STRINGDEPPATH) $(PTHREADDEPPATH) \
|
2011-04-02 17:25:22 +02:00
|
|
|
$(SEMDEPPATH) $(SIGDEPPATH) $(MQDEPPATH) $(MATHDEPPATH) $(NETDEPPATH) \
|
|
|
|
$(TIMEDEPPATH) $(LIBGENDEPPATH) $(QUEUEDEPPATH) $(MISCDEPPATH) \
|
2011-03-30 21:51:19 +02:00
|
|
|
$(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
2008-01-08 14:41:00 +01:00
|
|
|
@touch $@
|
2007-02-18 00:21:28 +01:00
|
|
|
|
|
|
|
depend: .depend
|
|
|
|
|
2011-04-06 18:40:47 +02:00
|
|
|
# Clean Targets:
|
|
|
|
# Clean user-mode temporary files (retaining the UBIN binary)
|
|
|
|
|
2011-04-05 22:54:00 +02:00
|
|
|
uclean:
|
2011-04-06 18:40:47 +02:00
|
|
|
ifneq ($(OBJEXT),)
|
|
|
|
@( if [ -f .userlib ]; then rm -f *$(OBJEXT); fi )
|
|
|
|
endif
|
|
|
|
@rm -f .userlib *~ .*.swp
|
|
|
|
|
|
|
|
# Clean kernel-mode temporary files (retaining the KBIN binary)
|
2011-04-05 22:54:00 +02:00
|
|
|
|
|
|
|
kclean:
|
2011-04-06 18:40:47 +02:00
|
|
|
ifneq ($(OBJEXT),)
|
|
|
|
@( if [ -f .kernlib ]; then rm -f *$(OBJEXT); fi )
|
|
|
|
endif
|
|
|
|
@rm -f .kernlib *~ .*.swp
|
|
|
|
|
|
|
|
# Really clean everything
|
2011-04-05 22:54:00 +02:00
|
|
|
|
|
|
|
clean: uclean kclean
|
2011-04-06 18:40:47 +02:00
|
|
|
@rm -f $(BIN) $(UBIN) $(KBIN) *~ .*.swp
|
2008-01-10 19:23:08 +01:00
|
|
|
$(call CLEAN)
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2011-04-06 18:40:47 +02:00
|
|
|
# Deep clean -- removes all traces of the configuration
|
|
|
|
|
2007-02-18 00:21:28 +01:00
|
|
|
distclean: clean
|
2008-01-10 19:23:08 +01:00
|
|
|
@rm -f Make.dep .depend
|
2007-02-18 00:21:28 +01:00
|
|
|
|
|
|
|
-include Make.dep
|