Changes in uspace/lib/posix/Makefile [3a37751:2660ee3] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/Makefile
r3a37751 r2660ee3 37 37 LIBC_FILE = $(LIBC_PREFIX)/libc.a 38 38 39 FIXED_POSIX_LIBRARY = libposixaslibc.a40 39 FIXED_C_LIBRARY = libc4posix.a 41 40 MERGED_C_LIBRARY = libc.a 42 41 MERGE_LIBRARIES = \ 43 42 $(FIXED_C_LIBRARY) \ 44 $( FIXED_POSIX_LIBRARY)\43 $(LIBRARY).a \ 45 44 $(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a \ 46 45 $(LIBSOFTINT_PREFIX)/libsoftint.a 47 46 47 SPECS = gcc.specs 48 LIBC_LINKER_SCRIPT = $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld 49 LIBC_STARTUP_FILE = $(shell sed -n -e 's/^.*STARTUP(\(.*\)).*$$/\1/p' $(LIBC_LINKER_SCRIPT)) 50 EXPORT_LINKER_SCRIPT = link.ld 51 EXPORT_STARTUP_FILE = crt0.o 52 53 EXPORT_FILES = \ 54 ../math/libmath.a \ 55 ../clui/libclui.a \ 56 $(MERGED_C_LIBRARY) \ 57 $(EXPORT_STARTUP_FILE) \ 58 $(EXPORT_LINKER_SCRIPT) \ 59 $(SPECS) 60 48 61 REDEFS_HIDE_LIBC = redefs-hide-libc-symbols.list 49 REDEFS_SHOW_LIBPOSIX = redefs-show-posix-symbols.list50 COLLISIONS_LIST = collisions.list51 62 52 63 PRE_DEPEND = $(INCLUDE_LIBC) … … 54 65 $(INCLUDE_LIBC) \ 55 66 $(REDEFS_HIDE_LIBC) \ 56 $(REDEFS_SHOW_LIBPOSIX) \57 $(COLLISIONS_LIST) \58 67 libc.o 59 68 60 EXTRA_OUTPUT = $(FIXED_C_LIBRARY) $(FIXED_POSIX_LIBRARY) $(MERGED_C_LIBRARY) 69 EXTRA_OUTPUT = $(FIXED_C_LIBRARY) $(FIXED_POSIX_LIBRARY) $(MERGED_C_LIBRARY) $(SPECS) $(EXPORT_LINKER_SCRIPT) $(EXPORT_STARTUP_FILE) 61 70 62 71 SOURCES = \ 63 source/ctype.c \ 64 source/dlfcn.c \ 65 source/errno.c \ 66 source/fcntl.c \ 67 source/fnmatch.c \ 68 source/getopt.c \ 69 source/locale.c \ 70 source/pthread/condvar.c \ 71 source/pthread/keys.c \ 72 source/pthread/mutex.c \ 73 source/pthread/threads.c \ 74 source/pwd.c \ 75 source/signal.c \ 76 source/stdio.c \ 77 source/stdio/scanf.c \ 78 source/stdlib.c \ 79 source/stdlib/strtol.c \ 80 source/stdlib/strtold.c \ 81 source/string.c \ 82 source/strings.c \ 83 source/sys/mman.c \ 84 source/sys/stat.c \ 85 source/sys/wait.c \ 86 source/time.c \ 87 source/unistd.c 72 src/ctype.c \ 73 src/dlfcn.c \ 74 src/fcntl.c \ 75 src/fnmatch.c \ 76 src/locale.c \ 77 src/pthread/condvar.c \ 78 src/pthread/keys.c \ 79 src/pthread/mutex.c \ 80 src/pthread/threads.c \ 81 src/pwd.c \ 82 src/signal.c \ 83 src/stdio.c \ 84 src/stdio/scanf.c \ 85 src/stdlib.c \ 86 src/stdlib/strtold.c \ 87 src/string.c \ 88 src/strings.c \ 89 src/sys/mman.c \ 90 src/sys/stat.c \ 91 src/sys/wait.c \ 92 src/time.c \ 93 src/unistd.c 88 94 89 95 TEST_SOURCES = \ … … 91 97 test/scanf.c 92 98 99 EXPORT_CPPFLAGS = \ 100 -specs $$(HELENOS_EXPORT_ROOT)/lib/gcc.specs \ 101 -isystem $$(HELENOS_EXPORT_ROOT)/include 102 103 EXPORT_LDFLAGS = \ 104 -L$$(HELENOS_EXPORT_ROOT)/lib \ 105 --whole-archive -lc -lmath --no-whole-archive \ 106 -T link.ld 107 108 EXPORT_CFLAGS = \ 109 $(EXPORT_CPPFLAGS) \ 110 $(addprefix -Xlinker , $(EXPORT_LDFLAGS)) 111 93 112 include $(USPACE_PREFIX)/Makefile.common 94 113 95 $(INCLUDE_LIBC): ../c/include 96 ln -s -f -n ../$^ $@ 114 $(SPECS): $(CONFIG_MAKEFILE) 115 echo '*self_spec:' > $@.new 116 echo '+ $(COMMON_CFLAGS)' >> $@.new 117 echo >> $@.new 118 echo '*lib:' >> $@.new 119 echo '--whole-archive -lc -lmath --no-whole-archive' >> $@.new 120 echo >> $@.new 121 mv $@.new $@ 97 122 98 $(FIXED_C_LIBRARY): $(LIBC_FILE) $(REDEFS_HIDE_LIBC) $(REDEFS_SHOW_LIBPOSIX) 123 $(EXPORT_LINKER_SCRIPT): $(LIBC_LINKER_SCRIPT) 124 sed 's/STARTUP(.*)/STARTUP(crt0.o)/' $< > $@ 125 126 $(EXPORT_STARTUP_FILE): $(LIBC_STARTUP_FILE) 127 cp $< $@ 128 129 $(INCLUDE_LIBC): $(shell find ../c/include -name '*.h') 130 cp -r -L --remove-destination -T ../c/include $@ 131 find ../c/include -type f -and -not -name '*.h' -delete 132 133 export: $(EXPORT_DIR)/config.mk $(EXPORT_DIR)/config.rc 134 135 $(EXPORT_DIR)/config.mk: export-libs export-includes 136 echo '# Generated file, do not modify.' >> $@.new 137 echo '# Do not forget to set HELENOS_EXPORT_ROOT.' >> $@.new 138 echo 'HELENOS_CROSS_PATH="$(shell dirname $(CC))"' >> $@.new 139 echo 'HELENOS_TARGET="$(TARGET)"' >> $@.new 140 echo 'HELENOS_CPPFLAGS="$(EXPORT_CPPFLAGS)"' >> $@.new 141 echo 'HELENOS_CFLAGS="$(EXPORT_CFLAGS)"' >> $@.new 142 echo 'HELENOS_LDFLAGS="$(EXPORT_LDFLAGS)"' >> $@.new 143 mv $@.new $@ 144 145 $(EXPORT_DIR)/config.rc: $(EXPORT_DIR)/config.mk 146 sed 's:$$(HELENOS_EXPORT_ROOT):$$HELENOS_EXPORT_ROOT:g' < $< >$@ 147 148 export-libs: $(EXPORT_FILES) export-includes 149 mkdir -p $(EXPORT_DIR)/lib 150 cp -L $(EXPORT_FILES) $(EXPORT_DIR)/lib 151 152 export-includes: $(INCLUDE_LIBC) $(shell find ./include ../c/arch/$(UARCH)/include $(ROOT_PATH)/abi/include -name '*.h') 153 mkdir -p $(EXPORT_DIR)/include 154 rm -rf $(EXPORT_DIR)/include.new 155 cp -r -L -T ./include/posix $(EXPORT_DIR)/include.new 156 cp -r -L -T ./include/libc $(EXPORT_DIR)/include.new/libc 157 cp -r -L ../c/arch/$(UARCH)/include/* $(EXPORT_DIR)/include.new/libc 158 cp -r -L $(ROOT_PATH)/abi/include/* $(EXPORT_DIR)/include.new 159 mkdir -p $(EXPORT_DIR)/include.new/libclui 160 cp -L ../clui/tinput.h $(EXPORT_DIR)/include.new/libclui 161 162 find "$(EXPORT_DIR)/include.new/libc" "$(EXPORT_DIR)/include.new/libclui" -name '*.h' -exec sed \ 163 -e 's:#include <:#include <libc/:' \ 164 -e 's:#include <libc/abi/:#include <abi/:' \ 165 -e 's:#include <libc/_bits/:#include <_bits/:' \ 166 -e 's:#include <libc/libc/:#include <libc/:' \ 167 -i {} \; 168 find "$(EXPORT_DIR)/include.new" -name '*.h' -exec sed \ 169 -e 's:#include "posix/:#include ":' \ 170 -e 's:#include <posix/:#include <:' \ 171 -i {} \; 172 173 rm -rf $(EXPORT_DIR)/include 174 mv $(EXPORT_DIR)/include.new $(EXPORT_DIR)/include 175 176 $(FIXED_C_LIBRARY): $(LIBC_FILE) $(REDEFS_HIDE_LIBC) 99 177 $(OBJCOPY) --redefine-syms=$(REDEFS_HIDE_LIBC) $(LIBC_FILE) $@ 100 $(OBJCOPY) --redefine-syms=$(REDEFS_SHOW_LIBPOSIX) $@ $@101 102 $(FIXED_POSIX_LIBRARY): $(LIBRARY).a $(REDEFS_HIDE_LIBC) $(REDEFS_SHOW_LIBPOSIX)103 $(OBJCOPY) --redefine-syms=$(REDEFS_HIDE_LIBC) $(LIBRARY).a $@104 $(OBJCOPY) --redefine-syms=$(REDEFS_SHOW_LIBPOSIX) $@ $@105 178 106 179 $(MERGED_C_LIBRARY): $(MERGE_LIBRARIES) … … 108 181 $(AR) rc $@ libc.o 109 182 110 $(REDEFS_HIDE_LIBC): $(COLLISIONS_LIST) 111 sed 's/.*/& __helenos_libc_&/' <$(COLLISIONS_LIST) >$@ 112 113 $(REDEFS_SHOW_LIBPOSIX): $(COLLISIONS_LIST) 114 sed 's/.*/posix_& &/' <$(COLLISIONS_LIST) >$@ 115 116 $(COLLISIONS_LIST): include/posix/*.h include/posix/*/*.h 117 find ./include/posix -name '*.h' -exec \ 118 sed -n -e '/^#/d' -e 's/__POSIX_DEF__/\n&/gp' {} \; | \ 119 sed -n -e 's/__POSIX_DEF__(\([^)]*\)).*/\1/p' | \ 120 sort -u >$@ 183 $(REDEFS_HIDE_LIBC): $(SOURCES) 184 sed -n -e 's/_HIDE_LIBC_SYMBOL(\(.*\))/\1 __helenos_libc_\1/p' $(SOURCES) >$@
Note:
See TracChangeset
for help on using the changeset viewer.