summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2011-06-25 11:57:32 +0100
committerMans Rullgard <mans@mansr.com>2011-06-26 23:07:40 +0100
commitbc877faf7f92deef9c619d81bec85202b9f10f0e (patch)
tree62eb10692ff1cca2a61419bd77f4bf8ccc73a81d /Makefile
parent97535ffb9795f59c4fbfacfe1541d752ed47218e (diff)
build: factor out the .c and .S compile commands as a macro
These commands have the same form, and using a common macro allows it to be used elsewhere without further duplication. Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile15
1 files changed, 11 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index f1bede83db..f16da3acca 100644
--- a/Makefile
+++ b/Makefile
@@ -23,16 +23,23 @@ endif
IFLAGS := -I. -I$(SRC_PATH)
CPPFLAGS := $(IFLAGS) $(CPPFLAGS)
CFLAGS += $(ECFLAGS)
+CCFLAGS = $(CFLAGS)
YASMFLAGS += $(IFLAGS) -Pconfig.asm
HOSTCFLAGS += $(IFLAGS)
+define COMPILE
+ $($(1)DEP)
+ $($(1)) $(CPPFLAGS) $($(1)FLAGS) $($(1)_DEPFLAGS) -c $($(1)_O) $<
+endef
+
+COMPILE_C = $(call COMPILE,CC)
+COMPILE_S = $(call COMPILE,AS)
+
%.o: %.c
- $(CCDEP)
- $(CC) $(CPPFLAGS) $(CFLAGS) $(CC_DEPFLAGS) -c $(CC_O) $<
+ $(COMPILE_C)
%.o: %.S
- $(ASDEP)
- $(AS) $(CPPFLAGS) $(ASFLAGS) $(AS_DEPFLAGS) -c -o $@ $<
+ $(COMPILE_S)
%.ho: %.h
$(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $<