source: mainline/uspace/lib/posix/Makefile@ ec9aadd

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

Do not use GCC specsfiles for building ports

  • Property mode set to 100644
File size: 4.7 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]37EXPORT_FILES = \
38 ../math/libmath.a \
39 ../clui/libclui.a \
[ba3841e2]40 $(LIBC_PREFIX)/libc.a \
[2eadda9]41 $(LIBC_PREFIX)/crt0.o \
42 $(LIBC_PREFIX)/crt1.o \
[ec9aadd]43 $(LIBRARY).a
[2660ee3]44
[c773adc]45PRE_DEPEND = $(INCLUDE_LIBC)
[ba3841e2]46EXTRA_CLEAN = $(INCLUDE_LIBC)
[3a37751]47
[2d2b8e6]48SOURCES = \
[df2e5514]49 src/ctype.c \
50 src/dlfcn.c \
51 src/fcntl.c \
52 src/fnmatch.c \
53 src/locale.c \
54 src/pthread/condvar.c \
55 src/pthread/keys.c \
56 src/pthread/mutex.c \
57 src/pthread/threads.c \
58 src/pwd.c \
59 src/signal.c \
60 src/stdio.c \
61 src/stdlib.c \
62 src/string.c \
63 src/strings.c \
64 src/sys/mman.c \
65 src/sys/stat.c \
66 src/sys/wait.c \
67 src/time.c \
68 src/unistd.c
[2d2b8e6]69
[eeb23f2d]70TEST_SOURCES = \
71 test/main.c \
[4e6a610]72 test/stdio.c \
73 test/stdlib.c \
74 test/unistd.c
75
76EXTRA_TEST_CFLAGS = -Wno-deprecated-declarations
[eeb23f2d]77
[2660ee3]78EXPORT_CPPFLAGS = \
[ec9aadd]79 -isystem $$(HELENOS_EXPORT_ROOT)/include \
80 $(COMMON_CPPFLAGS)
[2660ee3]81
82EXPORT_LDFLAGS = \
[fc0b2a8]83 -L$$(HELENOS_EXPORT_ROOT)/lib \
[2eadda9]84 $$(HELENOS_EXPORT_ROOT)/lib/crt0.o \
85 $$(HELENOS_EXPORT_ROOT)/lib/crt1.o
[2660ee3]86
[ea42e44]87EXPORT_LDLIBS = \
[954c024]88 -Wl,--start-group -lposix -lmath -lc -lgcc -Wl,--end-group
[ea42e44]89
[2660ee3]90EXPORT_CFLAGS = \
[ec9aadd]91 $(COMMON_CFLAGS)
[2660ee3]92
[2d2b8e6]93include $(USPACE_PREFIX)/Makefile.common
94
[2660ee3]95$(INCLUDE_LIBC): $(shell find ../c/include -name '*.h')
96 cp -r -L --remove-destination -T ../c/include $@
97 find ../c/include -type f -and -not -name '*.h' -delete
98
99export: $(EXPORT_DIR)/config.mk $(EXPORT_DIR)/config.rc
100
101$(EXPORT_DIR)/config.mk: export-libs export-includes
102 echo '# Generated file, do not modify.' >> $@.new
103 echo '# Do not forget to set HELENOS_EXPORT_ROOT.' >> $@.new
[bbe5e34]104 echo 'HELENOS_CROSS_PATH="$(shell dirname `which "$(CC)"`)"' >> $@.new
[ea42e44]105 echo 'HELENOS_ARCH="$(firstword $(subst -, ,$(TARGET)))"' >> $@.new
[2660ee3]106 echo 'HELENOS_TARGET="$(TARGET)"' >> $@.new
107 echo 'HELENOS_CPPFLAGS="$(EXPORT_CPPFLAGS)"' >> $@.new
108 echo 'HELENOS_CFLAGS="$(EXPORT_CFLAGS)"' >> $@.new
[ea42e44]109 echo 'HELENOS_CXXFLAGS="$(EXPORT_CFLAGS)"' >> $@.new
[2660ee3]110 echo 'HELENOS_LDFLAGS="$(EXPORT_LDFLAGS)"' >> $@.new
[ea42e44]111 echo 'HELENOS_LDLIBS="$(EXPORT_LDLIBS)"' >> $@.new
[2660ee3]112 mv $@.new $@
113
114$(EXPORT_DIR)/config.rc: $(EXPORT_DIR)/config.mk
115 sed 's:$$(HELENOS_EXPORT_ROOT):$$HELENOS_EXPORT_ROOT:g' < $< >$@
116
117export-libs: $(EXPORT_FILES) export-includes
118 mkdir -p $(EXPORT_DIR)/lib
119 cp -L $(EXPORT_FILES) $(EXPORT_DIR)/lib
120
121export-includes: $(INCLUDE_LIBC) $(shell find ./include ../c/arch/$(UARCH)/include $(ROOT_PATH)/abi/include -name '*.h')
122 mkdir -p $(EXPORT_DIR)/include
123 rm -rf $(EXPORT_DIR)/include.new
124 cp -r -L -T ./include/posix $(EXPORT_DIR)/include.new
125 cp -r -L -T ./include/libc $(EXPORT_DIR)/include.new/libc
126 cp -r -L ../c/arch/$(UARCH)/include/* $(EXPORT_DIR)/include.new/libc
127 cp -r -L $(ROOT_PATH)/abi/include/* $(EXPORT_DIR)/include.new
128 mkdir -p $(EXPORT_DIR)/include.new/libclui
129 cp -L ../clui/tinput.h $(EXPORT_DIR)/include.new/libclui
[f1380b7]130
[2660ee3]131 find "$(EXPORT_DIR)/include.new/libc" "$(EXPORT_DIR)/include.new/libclui" -name '*.h' -exec sed \
132 -e 's:#include <:#include <libc/:' \
133 -e 's:#include <libc/abi/:#include <abi/:' \
134 -e 's:#include <libc/_bits/:#include <_bits/:' \
135 -e 's:#include <libc/libc/:#include <libc/:' \
136 -i {} \;
137 find "$(EXPORT_DIR)/include.new" -name '*.h' -exec sed \
138 -e 's:#include "posix/:#include ":' \
139 -e 's:#include <posix/:#include <:' \
140 -i {} \;
[f1380b7]141
[2660ee3]142 rm -rf $(EXPORT_DIR)/include
143 mv $(EXPORT_DIR)/include.new $(EXPORT_DIR)/include
Note: See TracBrowser for help on using the repository browser.