- Timestamp:
- 2018-02-22T19:39:53Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0539c14
- Parents:
- 5fe3f954 (diff), df368491 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- uspace
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/Makefile
r5fe3f954 ree820ff 258 258 CLEANS := $(addsuffix .clean,$(DIRS) $(LIBS) $(BASE_LIBS)) 259 259 260 .PHONY: all $(BASE_BUILDS) $(BUILDS) $(BUILDS_TESTS) $(CLEANS) clean 260 .PHONY: all $(BASE_BUILDS) $(BUILDS) $(BUILDS_TESTS) $(CLEANS) clean export 261 261 262 262 all: $(BUILDS) $(BUILDS_TESTS) … … 264 264 $(BUILDS_TESTS): $(BASE_BUILDS) $(BUILDS) 265 265 $(MAKE) -r -C $(basename $@) all-test PRECHECK=$(PRECHECK) 266 267 export: lib/posix.build lib/math.build lib/clui.build 268 $(MAKE) -r -C lib/posix export EXPORT_DIR=$(EXPORT_DIR) 266 269 267 270 clean: $(CLEANS) -
uspace/Makefile.common
r5fe3f954 ree820ff 174 174 endif 175 175 176 COMMON_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \ 177 -ffreestanding -nostdlib -nostdinc -fexec-charset=UTF-8 \ 178 -finput-charset=UTF-8 -D__$(ENDIANESS)__ -D_HELENOS_SOURCE -fno-common \ 176 # Flags that are not necessary, and can be overriden, but are used by default. 177 DEFAULT_CFLAGS = \ 178 -O$(OPTIMIZATION) \ 179 -ffunction-sections \ 180 -pipe \ 181 -Wall \ 182 -Wextra \ 183 -Wno-unused-parameter \ 184 -Wmissing-prototypes \ 185 -Wwrite-strings \ 186 -Werror-implicit-function-declaration 187 188 ifeq ($(CONFIG_DEBUG),y) 189 DEFAULT_CFLAGS += -Werror 190 endif 191 192 ifeq ($(COMPILER),clang) 193 DEFAULT_CFLAGS += \ 194 -Wno-missing-field-initializers \ 195 -Wno-typedef-redefinition \ 196 -Wno-unused-command-line-argument 197 else 198 DEFAULT_CFLAGS += \ 199 -Wno-clobbered 200 endif 201 202 ifeq ($(CONFIG_LINE_DEBUG),y) 203 DEFAULT_CFLAGS += -ggdb 204 endif 205 206 # Flags that should always be used, even for third-party software. 207 COMMON_CPPFLAGS = \ 208 -nostdinc \ 209 -D__$(ENDIANESS)__ 210 211 COMMON_CFLAGS = \ 212 -ffreestanding \ 213 -nostdlib 214 215 # Flags that are always used for HelenOS code, but not for third-party. 216 HELENOS_CFLAGS = \ 217 -std=gnu99 \ 218 $(INCLUDES_FLAGS) \ 219 -imacros $(CONFIG_HEADER) \ 220 -D_HELENOS_SOURCE \ 221 -fexec-charset=UTF-8 \ 222 -finput-charset=UTF-8 \ 223 -fno-common \ 179 224 -fdebug-prefix-map=$(realpath $(ROOT_PATH))=. 180 225 181 GCC_CFLAGS = -ffunction-sections -Wall -Wextra -Wno-clobbered \ 182 -Wno-unused-parameter -Wmissing-prototypes -std=gnu99 \ 183 -Werror-implicit-function-declaration \ 184 -Wwrite-strings -pipe 185 186 # -Wno-missing-prototypes is there because it warns about main(). 187 # This should be fixed elsewhere. 188 CLANG_CFLAGS = -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-typedef-redefinition \ 189 -Wno-missing-prototypes -Wno-unused-command-line-argument \ 190 -std=gnu99 -Werror-implicit-function-declaration -Wwrite-strings \ 191 -pipe -fno-stack-protector -fno-PIC 192 193 ifeq ($(CONFIG_DEBUG),y) 194 COMMON_CFLAGS += -Werror 195 endif 196 197 ifeq ($(CONFIG_LINE_DEBUG),y) 198 GCC_CFLAGS += -ggdb 199 CLANG_CFLAGS += -g 200 endif 226 # TODO: Use a different name. 227 # CFLAGS variable is traditionally used for overridable flags. 228 CFLAGS = $(COMMON_CPPFLAGS) $(COMMON_CFLAGS) $(HELENOS_CFLAGS) $(DEFAULT_CFLAGS) 201 229 202 230 ## Setup platform configuration … … 216 244 endif 217 245 218 ifeq ($(COMPILER),clang)219 CFLAGS += $(COMMON_CFLAGS) $(CLANG_CFLAGS)220 else221 CFLAGS += $(COMMON_CFLAGS) $(GCC_CFLAGS)222 endif223 224 246 ifeq ($(CONFIG_STRIP_BINARIES),y) 225 247 LFLAGS += --strip-all … … 246 268 all-test: $(TEST_OUTPUTS) 247 269 248 clean: 249 rm -f $(JOB) $(OUTPUTS) $(EXTRA_CLEAN) tag deps.mk 270 clean: fasterclean 250 271 find . -name '*.o' -follow -exec rm \{\} \; 251 272 find . -name '*.lo' -follow -exec rm \{\} \; … … 253 274 254 275 fasterclean: 255 rm - f $(JOB) $(OUTPUTS) $(EXTRA_CLEAN) tag deps.mk276 rm -rf $(JOB) $(OUTPUTS) $(EXTRA_CLEAN) tag deps.mk 256 277 257 278 depend: $(PRE_DEPEND) -
uspace/lib/c/arch/amd64/Makefile.common
r5fe3f954 ree820ff 31 31 # XXX: clang doesn't support this flag, but the optimization is OS-specific, 32 32 # so it isn't used for amd64-unknown-elf target. 33 GCC_CFLAGS += -mno-tls-direct-seg-refs 33 34 ifneq ($(COMPILER),clang) 35 COMMON_CFLAGS += -mno-tls-direct-seg-refs 36 endif 34 37 35 38 LFLAGS += --gc-sections -
uspace/lib/c/include/macros.h
r5fe3f954 ree820ff 55 55 | ((((uint64_t) (up)) & 0xffffffff) << 32)) 56 56 57 #ifndef member_to_inst58 57 #define member_to_inst(ptr_member, type, member_identif) \ 59 ((type *) (((void*)(ptr_member)) - ((void*)&(((type*)0)->member_identif))))60 #endif 58 ((type *) (((void *) (ptr_member)) - \ 59 ((void *) &(((type *) 0)->member_identif)))) 61 60 61 #define _paddname(line) PADD_ ## line ## __ 62 #define _padd(width, line) uint ## width ## _t _paddname(line) 63 64 #define PADD32 _padd(32, __LINE__) 65 #define PADD16 _padd(16, __LINE__) 66 #define PADD8 _padd(8, __LINE__) 62 67 63 68 #endif 64 69 65 #define _paddname(line) PADD_ ## line ## __66 #define _padd(width, line) uint ## width ## _t _paddname(line)67 #define PADD32 _padd(32, __LINE__)68 #define PADD16 _padd(16, __LINE__)69 #define PADD8 _padd(8, __LINE__)70 71 70 /** @} 72 71 */ -
uspace/lib/posix/Makefile
r5fe3f954 ree820ff 45 45 $(LIBSOFTINT_PREFIX)/libsoftint.a 46 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 47 61 REDEFS_HIDE_LIBC = redefs-hide-libc-symbols.list 48 62 … … 53 67 libc.o 54 68 55 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) 56 70 57 71 SOURCES = \ … … 83 97 test/scanf.c 84 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 -T link.ld 106 107 EXPORT_LDLIBS = \ 108 -lmath -lc 109 110 EXPORT_CFLAGS = \ 111 -specs $$(HELENOS_EXPORT_ROOT)/lib/gcc.specs 112 85 113 include $(USPACE_PREFIX)/Makefile.common 86 114 87 $(INCLUDE_LIBC): ../c/include 88 ln -s -f -n ../$^ $@ 115 $(SPECS): $(CONFIG_MAKEFILE) 116 echo '*self_spec:' > $@.new 117 echo '+ $(COMMON_CFLAGS)' >> $@.new 118 echo >> $@.new 119 echo '*cpp:' >> $@.new 120 echo '+ $(COMMON_CPPFLAGS)' >> $@.new 121 echo >> $@.new 122 echo '*lib:' >> $@.new 123 echo '$(EXPORT_LDLIBS)' >> $@.new 124 mv $@.new $@ 125 126 $(EXPORT_LINKER_SCRIPT): $(LIBC_LINKER_SCRIPT) 127 sed 's/STARTUP(.*)/STARTUP(crt0.o)/' $< > $@ 128 129 $(EXPORT_STARTUP_FILE): $(LIBC_STARTUP_FILE) 130 cp $< $@ 131 132 $(INCLUDE_LIBC): $(shell find ../c/include -name '*.h') 133 cp -r -L --remove-destination -T ../c/include $@ 134 find ../c/include -type f -and -not -name '*.h' -delete 135 136 export: $(EXPORT_DIR)/config.mk $(EXPORT_DIR)/config.rc 137 138 $(EXPORT_DIR)/config.mk: export-libs export-includes 139 echo '# Generated file, do not modify.' >> $@.new 140 echo '# Do not forget to set HELENOS_EXPORT_ROOT.' >> $@.new 141 echo 'HELENOS_CROSS_PATH="$(shell dirname $(CC))"' >> $@.new 142 echo 'HELENOS_ARCH="$(firstword $(subst -, ,$(TARGET)))"' >> $@.new 143 echo 'HELENOS_TARGET="$(TARGET)"' >> $@.new 144 echo 'HELENOS_CPPFLAGS="$(EXPORT_CPPFLAGS)"' >> $@.new 145 echo 'HELENOS_CFLAGS="$(EXPORT_CFLAGS)"' >> $@.new 146 echo 'HELENOS_CXXFLAGS="$(EXPORT_CFLAGS)"' >> $@.new 147 echo 'HELENOS_LDFLAGS="$(EXPORT_LDFLAGS)"' >> $@.new 148 echo 'HELENOS_LDLIBS="$(EXPORT_LDLIBS)"' >> $@.new 149 mv $@.new $@ 150 151 $(EXPORT_DIR)/config.rc: $(EXPORT_DIR)/config.mk 152 sed 's:$$(HELENOS_EXPORT_ROOT):$$HELENOS_EXPORT_ROOT:g' < $< >$@ 153 154 export-libs: $(EXPORT_FILES) export-includes 155 mkdir -p $(EXPORT_DIR)/lib 156 cp -L $(EXPORT_FILES) $(EXPORT_DIR)/lib 157 158 export-includes: $(INCLUDE_LIBC) $(shell find ./include ../c/arch/$(UARCH)/include $(ROOT_PATH)/abi/include -name '*.h') 159 mkdir -p $(EXPORT_DIR)/include 160 rm -rf $(EXPORT_DIR)/include.new 161 cp -r -L -T ./include/posix $(EXPORT_DIR)/include.new 162 cp -r -L -T ./include/libc $(EXPORT_DIR)/include.new/libc 163 cp -r -L ../c/arch/$(UARCH)/include/* $(EXPORT_DIR)/include.new/libc 164 cp -r -L $(ROOT_PATH)/abi/include/* $(EXPORT_DIR)/include.new 165 mkdir -p $(EXPORT_DIR)/include.new/libclui 166 cp -L ../clui/tinput.h $(EXPORT_DIR)/include.new/libclui 167 168 find "$(EXPORT_DIR)/include.new/libc" "$(EXPORT_DIR)/include.new/libclui" -name '*.h' -exec sed \ 169 -e 's:#include <:#include <libc/:' \ 170 -e 's:#include <libc/abi/:#include <abi/:' \ 171 -e 's:#include <libc/_bits/:#include <_bits/:' \ 172 -e 's:#include <libc/libc/:#include <libc/:' \ 173 -i {} \; 174 find "$(EXPORT_DIR)/include.new" -name '*.h' -exec sed \ 175 -e 's:#include "posix/:#include ":' \ 176 -e 's:#include <posix/:#include <:' \ 177 -i {} \; 178 179 rm -rf $(EXPORT_DIR)/include 180 mv $(EXPORT_DIR)/include.new $(EXPORT_DIR)/include 89 181 90 182 $(FIXED_C_LIBRARY): $(LIBC_FILE) $(REDEFS_HIDE_LIBC) … … 97 189 $(REDEFS_HIDE_LIBC): $(SOURCES) 98 190 sed -n -e 's/_HIDE_LIBC_SYMBOL(\(.*\))/\1 __helenos_libc_\1/p' $(SOURCES) >$@ 99
Note:
See TracChangeset
for help on using the changeset viewer.