source: mainline/uspace/lib/posix/Makefile@ 954c024

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 954c024 was 954c024, checked in by Jiří Zárevúcky <jiri.zarevucky@…>, 7 years ago

Get rid of libsoftint and libsoftfloat in favor of using upstream libgcc.

  • Property mode set to 100644
File size: 5.0 KB
RevLine 
[2d2b8e6]1#
2# Copyright (c) 2011 Petr Koupy
3# Copyright (c) 2011 Jiri Zarevucky
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9#
10# - Redistributions of source code must retain the above copyright
11# notice, this list of conditions and the following disclaimer.
12# - Redistributions in binary form must reproduce the above copyright
13# notice, this list of conditions and the following disclaimer in the
14# documentation and/or other materials provided with the distribution.
15# - The name of the author may not be used to endorse or promote products
16# derived from this software without specific prior written permission.
17#
18# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28#
29
30USPACE_PREFIX = ../..
31LIBRARY = libposix
[965c250]32
[a3da2b2]33EXTRA_CFLAGS = -Iinclude/
34
35INCLUDE_LIBC = ./include/libc
[965c250]36
[2660ee3]37SPECS = gcc.specs
38
39EXPORT_FILES = \
40 ../math/libmath.a \
41 ../clui/libclui.a \
[ba3841e2]42 $(LIBC_PREFIX)/libc.a \
[2eadda9]43 $(LIBC_PREFIX)/crt0.o \
44 $(LIBC_PREFIX)/crt1.o \
[ba3841e2]45 $(LIBRARY).a \
[2660ee3]46 $(SPECS)
47
[c773adc]48PRE_DEPEND = $(INCLUDE_LIBC)
[ba3841e2]49EXTRA_CLEAN = $(INCLUDE_LIBC)
[3a37751]50
[82d9087]51EXTRA_OUTPUT = $(SPECS)
[2d2b8e6]52
53SOURCES = \
[df2e5514]54 src/ctype.c \
55 src/dlfcn.c \
56 src/fcntl.c \
57 src/fnmatch.c \
58 src/locale.c \
59 src/pthread/condvar.c \
60 src/pthread/keys.c \
61 src/pthread/mutex.c \
62 src/pthread/threads.c \
63 src/pwd.c \
64 src/signal.c \
65 src/stdio.c \
66 src/stdlib.c \
67 src/string.c \
68 src/strings.c \
69 src/sys/mman.c \
70 src/sys/stat.c \
71 src/sys/wait.c \
72 src/time.c \
73 src/unistd.c
[2d2b8e6]74
[eeb23f2d]75TEST_SOURCES = \
76 test/main.c \
[4e6a610]77 test/stdio.c \
78 test/stdlib.c \
79 test/unistd.c
80
81EXTRA_TEST_CFLAGS = -Wno-deprecated-declarations
[eeb23f2d]82
[2660ee3]83EXPORT_CPPFLAGS = \
84 -specs $$(HELENOS_EXPORT_ROOT)/lib/gcc.specs \
85 -isystem $$(HELENOS_EXPORT_ROOT)/include
86
87EXPORT_LDFLAGS = \
[fc0b2a8]88 -L$$(HELENOS_EXPORT_ROOT)/lib \
[2eadda9]89 $$(HELENOS_EXPORT_ROOT)/lib/crt0.o \
90 $$(HELENOS_EXPORT_ROOT)/lib/crt1.o
[2660ee3]91
[ea42e44]92EXPORT_LDLIBS = \
[954c024]93 -Wl,--start-group -lposix -lmath -lc -lgcc -Wl,--end-group
[ea42e44]94
[2660ee3]95EXPORT_CFLAGS = \
[ea42e44]96 -specs $$(HELENOS_EXPORT_ROOT)/lib/gcc.specs
[2660ee3]97
[2d2b8e6]98include $(USPACE_PREFIX)/Makefile.common
99
[2660ee3]100$(SPECS): $(CONFIG_MAKEFILE)
101 echo '*self_spec:' > $@.new
102 echo '+ $(COMMON_CFLAGS)' >> $@.new
103 echo >> $@.new
[ea42e44]104 echo '*cpp:' >> $@.new
105 echo '+ $(COMMON_CPPFLAGS)' >> $@.new
[2660ee3]106 echo >> $@.new
[ea42e44]107 echo '*lib:' >> $@.new
108 echo '$(EXPORT_LDLIBS)' >> $@.new
[2660ee3]109 mv $@.new $@
110
111$(INCLUDE_LIBC): $(shell find ../c/include -name '*.h')
112 cp -r -L --remove-destination -T ../c/include $@
113 find ../c/include -type f -and -not -name '*.h' -delete
114
115export: $(EXPORT_DIR)/config.mk $(EXPORT_DIR)/config.rc
116
117$(EXPORT_DIR)/config.mk: export-libs export-includes
118 echo '# Generated file, do not modify.' >> $@.new
119 echo '# Do not forget to set HELENOS_EXPORT_ROOT.' >> $@.new
[bbe5e34]120 echo 'HELENOS_CROSS_PATH="$(shell dirname `which "$(CC)"`)"' >> $@.new
[ea42e44]121 echo 'HELENOS_ARCH="$(firstword $(subst -, ,$(TARGET)))"' >> $@.new
[2660ee3]122 echo 'HELENOS_TARGET="$(TARGET)"' >> $@.new
123 echo 'HELENOS_CPPFLAGS="$(EXPORT_CPPFLAGS)"' >> $@.new
124 echo 'HELENOS_CFLAGS="$(EXPORT_CFLAGS)"' >> $@.new
[ea42e44]125 echo 'HELENOS_CXXFLAGS="$(EXPORT_CFLAGS)"' >> $@.new
[2660ee3]126 echo 'HELENOS_LDFLAGS="$(EXPORT_LDFLAGS)"' >> $@.new
[ea42e44]127 echo 'HELENOS_LDLIBS="$(EXPORT_LDLIBS)"' >> $@.new
[2660ee3]128 mv $@.new $@
129
130$(EXPORT_DIR)/config.rc: $(EXPORT_DIR)/config.mk
131 sed 's:$$(HELENOS_EXPORT_ROOT):$$HELENOS_EXPORT_ROOT:g' < $< >$@
132
133export-libs: $(EXPORT_FILES) export-includes
134 mkdir -p $(EXPORT_DIR)/lib
135 cp -L $(EXPORT_FILES) $(EXPORT_DIR)/lib
136
137export-includes: $(INCLUDE_LIBC) $(shell find ./include ../c/arch/$(UARCH)/include $(ROOT_PATH)/abi/include -name '*.h')
138 mkdir -p $(EXPORT_DIR)/include
139 rm -rf $(EXPORT_DIR)/include.new
140 cp -r -L -T ./include/posix $(EXPORT_DIR)/include.new
141 cp -r -L -T ./include/libc $(EXPORT_DIR)/include.new/libc
142 cp -r -L ../c/arch/$(UARCH)/include/* $(EXPORT_DIR)/include.new/libc
143 cp -r -L $(ROOT_PATH)/abi/include/* $(EXPORT_DIR)/include.new
144 mkdir -p $(EXPORT_DIR)/include.new/libclui
145 cp -L ../clui/tinput.h $(EXPORT_DIR)/include.new/libclui
[f1380b7]146
[2660ee3]147 find "$(EXPORT_DIR)/include.new/libc" "$(EXPORT_DIR)/include.new/libclui" -name '*.h' -exec sed \
148 -e 's:#include <:#include <libc/:' \
149 -e 's:#include <libc/abi/:#include <abi/:' \
150 -e 's:#include <libc/_bits/:#include <_bits/:' \
151 -e 's:#include <libc/libc/:#include <libc/:' \
152 -i {} \;
153 find "$(EXPORT_DIR)/include.new" -name '*.h' -exec sed \
154 -e 's:#include "posix/:#include ":' \
155 -e 's:#include <posix/:#include <:' \
156 -i {} \;
[f1380b7]157
[2660ee3]158 rm -rf $(EXPORT_DIR)/include
159 mv $(EXPORT_DIR)/include.new $(EXPORT_DIR)/include
Note: See TracBrowser for help on using the repository browser.