source: mainline/uspace/lib/posix/Makefile@ 0d14c25

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

Make some libc and libposix headers usable in C++

These headers either get included from standard C++ headers,
or are standard themselves, which means any unnamespaced nonstandard
identifiers are a problem. This commit attempts to fix those
issues, and removes hacks previously used in libcpp to work around it.

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