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

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

libposix: Change header organization and remove passthrough headers

Posix headers now function like an overlay. The system include directories
are searched after posix directories. The headers don't need to be patched
for export now. libposix files now include headers using bracket notation
instead of quoted notation.

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