Changeset 2660ee3 in mainline
- Timestamp:
- 2018-01-31T17:47:53Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a912aff, b500939e, ea42e44
- Parents:
- 14d789c
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-31 17:47:53)
- git-committer:
- GitHub <noreply@…> (2018-01-31 17:47:53)
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile
r14d789c r2660ee3 48 48 ERRNO_INPUT = abi/include/abi/errno.in 49 49 50 .PHONY: all precheck cscope cscope_parts autotool config_auto config_default config distclean clean check releasefile release common boot kernel uspace 50 .PHONY: all precheck cscope cscope_parts autotool config_auto config_default config distclean clean check releasefile release common boot kernel uspace export-posix 51 51 52 52 all: kernel uspace … … 60 60 uspace: common 61 61 $(MAKE) -r -C uspace PRECHECK=$(PRECHECK) 62 63 export-posix: common 64 ifndef EXPORT_DIR 65 @echo ERROR: Variable EXPORT_DIR is not defined. && false 66 else 67 $(MAKE) -r -C uspace export EXPORT_DIR=$(abspath $(EXPORT_DIR)) 68 endif 62 69 63 70 precheck: clean -
tools/autotool.py
r14d789c r2660ee3 615 615 path = "%s/%s/bin" % (cross_prefix, platform) 616 616 617 common['TARGET'] = target 617 618 prefix = "%s-" % target 618 619 -
uspace/Makefile
r14d789c r2660ee3 255 255 CLEANS := $(addsuffix .clean,$(DIRS) $(LIBS) $(BASE_LIBS)) 256 256 257 .PHONY: all $(BASE_BUILDS) $(BUILDS) $(BUILDS_TESTS) $(CLEANS) clean 257 .PHONY: all $(BASE_BUILDS) $(BUILDS) $(BUILDS_TESTS) $(CLEANS) clean export 258 258 259 259 all: $(BUILDS) $(BUILDS_TESTS) … … 261 261 $(BUILDS_TESTS): $(BASE_BUILDS) $(BUILDS) 262 262 $(MAKE) -r -C $(basename $@) all-test PRECHECK=$(PRECHECK) 263 264 export: lib/posix.build lib/math.build lib/clui.build 265 $(MAKE) -r -C lib/posix export EXPORT_DIR=$(EXPORT_DIR) 263 266 264 267 clean: $(CLEANS) -
uspace/Makefile.common
r14d789c r2660ee3 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_CFLAGS = \ 208 -ffreestanding \ 209 -nostdlib \ 210 -nostdinc \ 211 -D__$(ENDIANESS)__ 212 213 # Flags that are always used for HelenOS code, but not for third-party. 214 HELENOS_CFLAGS = \ 215 -std=gnu99 \ 216 $(INCLUDES_FLAGS) \ 217 -imacros $(CONFIG_HEADER) \ 218 -D_HELENOS_SOURCE \ 219 -fexec-charset=UTF-8 \ 220 -finput-charset=UTF-8 \ 221 -fno-common \ 179 222 -fdebug-prefix-map=$(realpath $(ROOT_PATH))=. 180 223 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 224 # TODO: Use a different name. 225 # CFLAGS variable is traditionally used for overridable flags. 226 CFLAGS = $(COMMON_CFLAGS) $(HELENOS_CFLAGS) $(DEFAULT_CFLAGS) 201 227 202 228 ## Setup platform configuration … … 216 242 endif 217 243 218 ifeq ($(COMPILER),clang)219 CFLAGS += $(COMMON_CFLAGS) $(CLANG_CFLAGS)220 else221 CFLAGS += $(COMMON_CFLAGS) $(GCC_CFLAGS)222 endif223 224 244 ifeq ($(CONFIG_STRIP_BINARIES),y) 225 245 LFLAGS += --strip-all … … 246 266 all-test: $(TEST_OUTPUTS) 247 267 248 clean: 249 rm -f $(JOB) $(OUTPUTS) $(EXTRA_CLEAN) tag deps.mk 268 clean: fasterclean 250 269 find . -name '*.o' -follow -exec rm \{\} \; 251 270 find . -name '*.lo' -follow -exec rm \{\} \; … … 253 272 254 273 fasterclean: 255 rm - f $(JOB) $(OUTPUTS) $(EXTRA_CLEAN) tag deps.mk274 rm -rf $(JOB) $(OUTPUTS) $(EXTRA_CLEAN) tag deps.mk 256 275 257 276 depend: $(PRE_DEPEND) -
uspace/lib/c/arch/amd64/Makefile.common
r14d789c r2660ee3 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/posix/Makefile
r14d789c r2660ee3 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 --whole-archive -lc -lmath --no-whole-archive \ 106 -T link.ld 107 108 EXPORT_CFLAGS = \ 109 $(EXPORT_CPPFLAGS) \ 110 $(addprefix -Xlinker , $(EXPORT_LDFLAGS)) 111 85 112 include $(USPACE_PREFIX)/Makefile.common 86 113 87 $(INCLUDE_LIBC): ../c/include 88 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 $@ 122 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 89 175 90 176 $(FIXED_C_LIBRARY): $(LIBC_FILE) $(REDEFS_HIDE_LIBC) … … 97 183 $(REDEFS_HIDE_LIBC): $(SOURCES) 98 184 sed -n -e 's/_HIDE_LIBC_SYMBOL(\(.*\))/\1 __helenos_libc_\1/p' $(SOURCES) >$@ 99
Note:
See TracChangeset
for help on using the changeset viewer.