]> rtime.felk.cvut.cz Git - omk.git/blobdiff - snippets/gcc
Removed binary-pass and converted to link-pseudo-pass - it doesn't work
[omk.git] / snippets / gcc
index 4b1b5d81a4cce15f032d9e698208501f1c518e43..a6d7c5184a46dbae50afd98e3185d8f5a19c62d1 100644 (file)
 # Output variables:
 # SOURCES - all the source files that needs to be compiled (except for shared library sources)
 # SOLIB_SOURCES - all the source files that needs to be compiled for a shared library
+# OBJ_EXT - extension of object files
+# LIB_EXT - extension of library files
+# LIB_PREF - prefix for library files
+# ASM_EXT - extension of assembler sources
 
 # Templates:
 # COMPILER_DEFS_template - definitions that should be defined before
 # library. The rules can use rules produced by COMPILE_xxx_template.
 
 define COMPILER_DEFS_template
+OBJ_EXT = .o
+LIB_EXT = .a
+LIB_PREF = lib
+ASM_EXT = .S
+
 CC = $(CROSS_COMPILE)gcc
 LINK = $(CROSS_COMPILE)ld
 AR = $(CROSS_COMPILE)ar
@@ -74,15 +83,12 @@ else
 CC_DEPFLAGS = -MT $$@ -MD -MP -MF "$$@.d.tmp"
 endif
 
-# lib_obj_SOURCES handling
-$(LIB_DIR)/%.o: %.o
-       @cp $$(CP_FLAGS) $$< $$@
 endef # COMPILER_DEFS_template
 
 
 # Syntax: $(call COMPILE_c_o_template,<source>,<target>,<additional c-flags>)
 define COMPILE_c_o_template
-$(2): $(1) $(LOCAL_CONFIG_H) $$(GEN_HEADERS)
+$(2): $(1) $$(GEN_HEADERS)
        @$(QUIET_CMD_ECHO) "  CC      $$@"
        $(Q) if $$(c_o_COMPILE) $$(CC_DEPFLAGS) $(3) -o $$@ -c $$< ; \
        then mv -f "$$@.d.tmp" "$$@.d" ; \
@@ -94,7 +100,7 @@ endef
 
 # Syntax: $(call COMPILE_cc_o_template,<source>,<target>,<additional c-flags>)
 define COMPILE_cc_o_template
-$(2): $(1) $(LOCAL_CONFIG_H) $$(GEN_HEADERS)
+$(2): $(1) $$(GEN_HEADERS)
        @$(QUIET_CMD_ECHO) "  CXX     $$@"
        $(Q) if $$(cc_o_COMPILE) $$(CC_DEPFLAGS) $(3) -o $$@ -c $$< ; \
        then mv -f "$$@.d.tmp" "$$@.d" ; \
@@ -104,7 +110,7 @@ endef
 
 # Syntax: $(call COMPILE_S_o_template,<source>,<target>,<additional c-flags>)
 define COMPILE_S_o_template
-$(2): $(1) $(LOCAL_CONFIG_H) $$(GEN_HEADERS)
+$(2): $(1) $$(GEN_HEADERS)
        @$(QUIET_CMD_ECHO) "  AS      $$@"
        $(Q) if $$(S_o_COMPILE) -D__ASSEMBLY__ $$(CC_DEPFLAGS) $(3) -o $$@ -c $$< ; \
        then if [ -e "$$@.d.tmp" ] ; then mv -f "$$@.d.tmp" "$$@.d" ; fi ; \
@@ -156,7 +162,7 @@ $(2)/$(1)$(3:%=-%): $$($(1)_OBJS)
        @echo "$(2)/$(1)$(3:%=-%): \\" >$(OBJS_DIR)/$(1)$(3:%=-%).exe.d
        @if [ -n "$(LD_SCRIPT)" ]; then \
          echo "  $(LIB_DIR)/$(LD_SCRIPT).ld$(3:%=-%) \\" >>$(OBJS_DIR)/$(1)$(3:%=-%).exe.d; fi
-       @sed -n -e 's/^LOAD \(.*\)$$$$/  \1  \\/p' $(OBJS_DIR)/$(1)$(3:%=-%).map  >>$(OBJS_DIR)/$(1)$(3:%=-%).exe.d
+       @sed -n -e 's|^LOAD \(.*\)$$$$|  \1  \&|p' $(OBJS_DIR)/$(1)$(3:%=-%).map|tr '&' '\134'  >>$(OBJS_DIR)/$(1)$(3:%=-%).exe.d
        @echo >>$(OBJS_DIR)/$(1).exe.d
 endef
 
@@ -205,18 +211,6 @@ $(LIB_DIR)/lib$(1).so: $$($(1)_OBJSLO)
        $(Q) $(LD) --shared --soname=lib$(1).so -o $$@ $$^
 endef
 
-
-# lib_obj_SOURCES handling
-lib_OBJS = $(addsuffix .o,$(basename $(lib_obj_SOURCES)))
-SOURCES += $(filter-out %.o,$(lib_obj_SOURCES))
-#$(warning lib_OBJS = $(lib_OBJS))
-
-# # Syntax: $(call LIBOBJ_template,<object-name>)
-# define LIBOBJ_template
-# $(LIB_DIR)/$(1): $(1)
-#      @cp $(CP_FLAGS) $$< $$@
-# endef
-
 # Local Variables:
 # mode:makefile
 # End: