]> rtime.felk.cvut.cz Git - omk.git/commitdiff
Add rules for .s assembler files
authorMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 26 Jun 2014 13:55:56 +0000 (15:55 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 26 Jun 2014 13:55:56 +0000 (15:55 +0200)
According to gcc documentation .s is processed by assembler without first
preprocessing it with CPP.

snippets/linux.omk
tests/asm [new file with mode: 0755]

index d477ab1eee853d145e905152b1deb480bb79dd9c..60ab085bcfe730237ff951bea691b5220f455af4 100644 (file)
@@ -167,6 +167,16 @@ $(2): $(1) $$(GEN_HEADERS)
 endif
 endef
 
+# Syntax: $(call COMPILE_s_o_template,<source>,<target>,<additional c-flags>)
+define COMPILE_s_o_template
+ifeq ($$($(2)_s_TARGET),)
+$(2)_s_TARGET=1
+$(2): $(1) $$(GEN_HEADERS)
+       @$(QUIET_CMD_ECHO) "  AS      $$@"
+       $(Q)$$(S_o_COMPILE) $(3) -o $$@ -c $$<
+endif
+endef
+
 # Syntax: $(call COMPILE_idl_template,</path/to/src.idl>,<basename>)
 define COMPILE_idl_template
 
@@ -191,7 +201,9 @@ $(foreach src,$(filter %.cxx,$(1)),$(call COMPILE_cc_o_template,$(src),$(3)$(not
 )
 $(foreach src,$(filter %.cpp,$(1)),$(call COMPILE_cc_o_template,$(src),$(3)$(notdir $(src:%.cpp=%$(2))),)
 )
-$(foreach src,$(filter %.S,$(1)),$(call COMPILE_S_o_template,$(src),$(3)$(notdir $(src:%.S=%$(2))),)
+$(foreach src,$(filter %.S,$(1)),$(call COMPILE_S_o_template,$(src),$(3)$(notdir $(basename $(src))$(2)),)
+)
+$(foreach src,$(filter %.s,$(1)),$(call COMPILE_s_o_template,$(src),$(3)$(notdir $(basename $(src))$(2)),)
 )
 endef
 
diff --git a/tests/asm b/tests/asm
new file mode 100755 (executable)
index 0000000..e57b8ad
--- /dev/null
+++ b/tests/asm
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+. ./wvtest.sh
+
+[[ $OMK_RULES != "linux" ]] && exit 0
+
+WVSTART "Compile assembler in .S file"
+cat > 'test.S' <<'EOF'
+.global main
+main:
+EOF
+cat > 'Makefile.omk' <<'EOF'
+bin_PROGRAMS = test
+test_SOURCES = test.S
+EOF
+needs_valid_CC
+WVPASS make V=1
+
+WVSTART "Compile assembler in .s file"
+cat > 'test.s' <<'EOF'
+.global main
+main:
+EOF
+cat > 'Makefile.omk' <<'EOF'
+bin_PROGRAMS = test
+test_SOURCES = test.s
+EOF
+needs_valid_CC
+WVPASS make V=1