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
|
|
|
#
|
2010-05-08 05:10:51 +02:00
|
|
|
# Copyright (C) 2007-2010 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
|
|
|
|
|
|
|
|
ASRCS =
|
2007-02-28 00:59:20 +01:00
|
|
|
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
2007-02-18 00:21:28 +01:00
|
|
|
|
2007-06-09 21:11:00 +02:00
|
|
|
MISC_SRCS = lib_init.c lib_filesem.c
|
|
|
|
ifneq ($(CONFIG_NFILE_STREAMS),0)
|
|
|
|
MISC_SRCS += lib_streamsem.c
|
|
|
|
endif
|
|
|
|
|
2009-06-14 17:36:18 +02:00
|
|
|
STRING_SRCS = lib_checkbase.c lib_isbasedigit.c lib_memset.c lib_memcpy.c \
|
|
|
|
lib_memcmp.c lib_memmove.c lib_skipspace.c lib_strcasecmp.c \
|
|
|
|
lib_strcat.c lib_strchr.c lib_strcpy.c lib_strcmp.c lib_strcspn.c \
|
2010-10-27 22:54:11 +02:00
|
|
|
lib_strdup.c lib_strerror.c lib_strlen.c lib_strnlen.c \
|
|
|
|
lib_strncasecmp.c lib_strncat.c lib_strncmp.c lib_strncpy.c \
|
|
|
|
lib_strpbrk.c lib_strrchr.c lib_strspn.c lib_strstr.c lib_strtok.c \
|
|
|
|
lib_strtokr.c lib_strtol.c lib_strtoll.c lib_strtoul.c \
|
|
|
|
lib_strtoull.c lib_strtod.c
|
2007-07-01 19:37:11 +02:00
|
|
|
|
2007-02-18 00:21:28 +01:00
|
|
|
CTYPE_SRCS =
|
2007-06-09 21:11:00 +02:00
|
|
|
|
2009-07-13 03:35:15 +02:00
|
|
|
STDIO_SRCS = lib_fileno.c lib_printf.c lib_rawprintf.c lib_lowprintf.c \
|
2008-01-09 02:13:24 +01:00
|
|
|
lib_sprintf.c lib_snprintf.c lib_libsprintf.c lib_vsprintf.c \
|
2009-05-30 22:06:24 +02:00
|
|
|
lib_vsnprintf.c lib_libvsprintf.c lib_meminstream.c \
|
|
|
|
lib_memoutstream.c lib_lowinstream.c lib_lowoutstream.c \
|
2009-06-01 16:24:29 +02:00
|
|
|
lib_zeroinstream.c lib_nullinstream.c lib_nulloutstream.c \
|
|
|
|
lib_sscanf.c
|
2007-07-01 19:37:11 +02:00
|
|
|
|
2007-06-09 21:11:00 +02:00
|
|
|
ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
|
2009-05-30 22:06:24 +02:00
|
|
|
STDIO_SRCS += lib_rawinstream.c lib_rawoutstream.c
|
2007-06-09 21:11:00 +02:00
|
|
|
ifneq ($(CONFIG_NFILE_STREAMS),0)
|
2008-02-01 23:32:16 +01:00
|
|
|
STDIO_SRCS += lib_fopen.c lib_fclose.c lib_fread.c lib_libfread.c lib_fseek.c \
|
2008-09-01 22:35:41 +02:00
|
|
|
lib_ftell.c lib_fsetpos.c lib_fgetpos.c lib_fgetc.c lib_fgets.c \
|
|
|
|
lib_gets.c lib_fwrite.c lib_libfwrite.c lib_fflush.c \
|
|
|
|
lib_libflushall.c lib_libfflush.c lib_rdflush.c lib_wrflush.c \
|
2008-02-06 02:29:23 +01:00
|
|
|
lib_fputc.c lib_puts.c lib_fputs.c lib_ungetc.c lib_vprintf.c \
|
2009-05-30 22:06:24 +02:00
|
|
|
lib_fprintf.c lib_vfprintf.c lib_stdinstream.c lib_stdoutstream.c
|
2007-06-09 21:11:00 +02:00
|
|
|
endif
|
|
|
|
endif
|
2010-05-08 05:10:51 +02:00
|
|
|
ifeq ($(CONFIG_LIBC_FLOATINGPOINT),y)
|
|
|
|
STDIO_SRCS += lib_dtoa.c
|
|
|
|
endif
|
2007-06-09 21:11:00 +02:00
|
|
|
|
2010-10-09 23:12:49 +02:00
|
|
|
STDLIB_SRCS = lib_abs.c lib_imaxabs.c lib_labs.c lib_llabs.c lib_rand.c lib_qsort.c
|
2007-06-09 21:11:00 +02:00
|
|
|
|
2008-11-29 02:19:35 +01:00
|
|
|
MATH_SRCS = lib_rint.c lib_fixedmath.c lib_b16sin.c lib_b16cos.c
|
2007-06-09 21:11:00 +02:00
|
|
|
|
2009-06-16 15:26:07 +02:00
|
|
|
UNISTD_SRCS = lib_getopt.c lib_getoptargp.c lib_getoptindp.c lib_getoptoptp.c
|
2008-08-23 17:16:10 +02:00
|
|
|
ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
|
|
|
|
ifneq ($(CONFIG_DISABLE_ENVIRON),y)
|
|
|
|
UNISTD_SRCS += lib_chdir.c lib_getcwd.c
|
|
|
|
endif
|
|
|
|
endif
|
2007-06-10 20:13:03 +02:00
|
|
|
|
2009-07-12 17:16:00 +02:00
|
|
|
TIME_SRCS = lib_mktime.c lib_gmtime.c lib_gmtimer.c lib_strftime.c \
|
|
|
|
lib_calendar2utc.c lib_daysbeforemonth.c lib_isleapyear.c
|
2009-07-11 19:24:14 +02:00
|
|
|
|
2007-12-11 15:23:58 +01:00
|
|
|
NET_SRCS = lib_htons.c lib_htonl.c lib_inetntoa.c lib_etherntoa.c
|
2007-09-02 17:32:03 +02:00
|
|
|
|
2007-07-01 19:37:11 +02:00
|
|
|
LIBGEN_SRCS = lib_basename.c lib_dirname.c
|
|
|
|
|
2009-07-11 15:59:42 +02:00
|
|
|
REGEX_SRCS = lib_match.c
|
|
|
|
|
2010-01-16 03:12:48 +01:00
|
|
|
CRC_SRCS = lib_crc32.c
|
|
|
|
|
2007-02-18 00:21:28 +01:00
|
|
|
SQ_SRCS = sq_addlast.c sq_addfirst.c sq_addafter.c \
|
|
|
|
sq_rem.c sq_remlast.c sq_remfirst.c sq_remafter.c
|
2007-06-09 21:11:00 +02:00
|
|
|
|
2007-02-18 00:21:28 +01:00
|
|
|
DQ_SRCS = dq_addlast.c dq_addfirst.c dq_addafter.c dq_addbefore.c \
|
|
|
|
dq_rem.c dq_remlast.c dq_remfirst.c
|
|
|
|
|
2009-06-25 19:44:35 +02:00
|
|
|
DBG_SRCS = lib_dbg.c lib_dumpbuffer.c
|
|
|
|
|
2007-09-02 17:32:03 +02:00
|
|
|
CSRCS = $(MISC_SRCS) $(STRING_SRCS) $(CTYPE_SRCS) $(STDIO_SRCS) $(STDLIB_SRCS) \
|
2009-07-11 19:24:14 +02:00
|
|
|
$(MATH_SRCS) $(UNISTD_SRCS) $(TIME_SRCS) $(NET_SRCS) $(LIBGEN_SRCS) \
|
2010-01-16 03:12:48 +01:00
|
|
|
$(REGEX_SRCS) $(CRC_SRCS) $(SQ_SRCS) $(DQ_SRCS) $(DBG_SRCS)
|
2007-02-28 00:59:20 +01:00
|
|
|
COBJS = $(CSRCS:.c=$(OBJEXT))
|
2007-02-18 00:21:28 +01:00
|
|
|
|
|
|
|
SRCS = $(ASRCS) $(CSRCS)
|
|
|
|
OBJS = $(AOBJS) $(COBJS)
|
|
|
|
|
2007-02-21 22:55:16 +01:00
|
|
|
BIN = liblib$(LIBEXT)
|
2007-02-18 00:21:28 +01:00
|
|
|
|
|
|
|
all: $(BIN)
|
|
|
|
|
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
|
|
|
|
|
|
|
.depend: Makefile $(SRCS)
|
2008-01-08 14:02:47 +01:00
|
|
|
@$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
2008-01-08 14:41:00 +01:00
|
|
|
@touch $@
|
2007-02-18 00:21:28 +01:00
|
|
|
|
|
|
|
depend: .depend
|
|
|
|
|
|
|
|
clean:
|
2008-01-10 19:23:08 +01:00
|
|
|
@rm -f $(BIN) *~ .*.swp
|
|
|
|
$(call CLEAN)
|
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
|