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
Line 
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
32
33EXTRA_CFLAGS = -Iinclude/
34
35INCLUDE_LIBC = ./include/libc
36
37SPECS = gcc.specs
38
39EXPORT_FILES = \
40 ../math/libmath.a \
41 ../clui/libclui.a \
42 $(LIBC_PREFIX)/libc.a \
43 $(LIBC_PREFIX)/crt0.o \
44 $(LIBC_PREFIX)/crt1.o \
45 $(LIBRARY).a \
46 $(SPECS)
47
48PRE_DEPEND = $(INCLUDE_LIBC)
49EXTRA_CLEAN = $(INCLUDE_LIBC)
50
51EXTRA_OUTPUT = $(SPECS)
52
53SOURCES = \
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
74
75TEST_SOURCES = \
76 test/main.c \
77 test/stdio.c \
78 test/stdlib.c \
79 test/unistd.c
80
81EXTRA_TEST_CFLAGS = -Wno-deprecated-declarations
82
83EXPORT_CPPFLAGS = \
84 -specs $$(HELENOS_EXPORT_ROOT)/lib/gcc.specs \
85 -isystem $$(HELENOS_EXPORT_ROOT)/include
86
87EXPORT_LDFLAGS = \
88 -L$$(HELENOS_EXPORT_ROOT)/lib \
89 $$(HELENOS_EXPORT_ROOT)/lib/crt0.o \
90 $$(HELENOS_EXPORT_ROOT)/lib/crt1.o
91
92EXPORT_LDLIBS = \
93 -Wl,--start-group -lposix -lmath -lc -lgcc -Wl,--end-group
94
95EXPORT_CFLAGS = \
96 -specs $$(HELENOS_EXPORT_ROOT)/lib/gcc.specs
97
98include $(USPACE_PREFIX)/Makefile.common
99
100$(SPECS): $(CONFIG_MAKEFILE)
101 echo '*self_spec:' > $@.new
102 echo '+ $(COMMON_CFLAGS)' >> $@.new
103 echo >> $@.new
104 echo '*cpp:' >> $@.new
105 echo '+ $(COMMON_CPPFLAGS)' >> $@.new
106 echo >> $@.new
107 echo '*lib:' >> $@.new
108 echo '$(EXPORT_LDLIBS)' >> $@.new
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
120 echo 'HELENOS_CROSS_PATH="$(shell dirname `which "$(CC)"`)"' >> $@.new
121 echo 'HELENOS_ARCH="$(firstword $(subst -, ,$(TARGET)))"' >> $@.new
122 echo 'HELENOS_TARGET="$(TARGET)"' >> $@.new
123 echo 'HELENOS_CPPFLAGS="$(EXPORT_CPPFLAGS)"' >> $@.new
124 echo 'HELENOS_CFLAGS="$(EXPORT_CFLAGS)"' >> $@.new
125 echo 'HELENOS_CXXFLAGS="$(EXPORT_CFLAGS)"' >> $@.new
126 echo 'HELENOS_LDFLAGS="$(EXPORT_LDFLAGS)"' >> $@.new
127 echo 'HELENOS_LDLIBS="$(EXPORT_LDLIBS)"' >> $@.new
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
146
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 {} \;
157
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.