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