]> rtime.felk.cvut.cz Git - omk.git/blobdiff - snippets/sysless.omk
Allow to define if default compiler provided startup file is linked into binary.
[omk.git] / snippets / sysless.omk
index 6977eac188433c9fe7442b260c9f3c0426d585b0..e55a0ae2e8178911cc9756b726b9f5555a52844c 100644 (file)
@@ -20,6 +20,8 @@
 #                     should be used for linking (e.g. ram flash). If this is not
 #                    specified, then the value of DEFAULT_LD_SCRIPT_VARIANT from config.target is used.
 # PREFIX_DIR       .. Prefix to  directories in _compiled and _build. Used in config.omk.
+# TARGET_STDSTARTFILES .. if left unset or set to `n', startup file provided
+#                     by compiler is supressed
 
 BUILD_DIR_NAME = _build$(addprefix /,$(PREFIX_DIR))
 COMPILED_DIR_NAME = _compiled$(addprefix /,$(PREFIX_DIR))
@@ -61,9 +63,18 @@ endif
 # Rules for compilation for target
 ifdef TARGET_RULE_TEMPLATES
 
+ifeq ($(TARGET_STDSTARTFILES),)
+TARGET_STDSTARTFILES=n
+endif
+
+ifneq ($(TARGET_STDSTARTFILES),y)
 LDFLAGS += -nostartfiles
+ifneq ($(TARGET_STDSTARTFILES),n)
+LDFLAGS += $(TARGET_STDSTARTFILES)
+endif
+endif
 
- # FIXME: These are not used. What they are good for?
+# FIXME: These are not used. What they are good for?
 LIB_CPPFLAGS += $(CPPFLAGS)
 LIB_CFLAGS   += $(CFLAGS)
 
@@ -122,6 +133,12 @@ SOLIB_SOURCES := $(sort $(SOLIB_SOURCES))
 #$(warning SOLIB_SOURCES = $(SOLIB_SOURCES))
 SOLIB_GEN_SOURCES := $(sort $(SOLIB_GEN_SOURCES))
 
+# Create _build directories for sources in subdirectories i.e. *_SOURCES=dir/file.c
+_dirs_to_create=$(filter-out ./,$(sort $(dir $(SOURCES) $(SOLIB_SOURCES))))
+ifneq ($(_dirs_to_create),)
+$(shell mkdir -p $(addprefix $(LOCAL_BUILD_DIR)/,$(_dirs_to_create)))
+endif
+
 # The above generated rules produced $(SOURCES) and $(SOLIB_SOURCES)
 # variables. Now generate rules for compilation of theese sources
 $(foreach src,$(filter %.c,$(SOURCES)),$(eval $(call COMPILE_c_o_template,$(SOURCES_DIR)/$(src),$(src:%.c=%$(OBJ_EXT)),)))
@@ -189,13 +206,6 @@ utils-pass-local: $(utils_PROGRAMS:%=$(USER_UTILS_DIR)/%)
 
 endif # HOST_RULE_TEMPLATES
 
-# Checks for OMK tester
-ifdef OMK_TESTSROOT
-default-config-pass-check include-pass-check:
-library-pass-check binary-pass-check:
-       @[ -x "$(shell which $(CC))" ] || $(call canttest,Cannot find compiler: $(CC))
-endif
-
 #=====================================================================
 # Automatic loading of compiled program by issuing "make load"