Welcome to little lamb

Code » comain » commit a2d962c

common.mk: Add support for binary-specific CFLAGS

author Olivier Brunel
2023-01-26 08:51:31 UTC
committer Olivier Brunel
2023-01-26 08:51:31 UTC
parent bb2ae27e7fe04d1565bafa04d785eded86941c5d

common.mk: Add support for binary-specific CFLAGS

common.mk +3 -3

diff --git a/common.mk b/common.mk
index a33832a..176de90 100644
--- a/common.mk
+++ b/common.mk
@@ -32,13 +32,13 @@ DATA =
 CLEAN = $(BINS) $(STATIC_LIBS) $(SHARED_LIBS) $(OBJS) $(DEPS)
 
 %.o: %.c Makefile common.mk config.mk project.mk
-	$(_CC) $(COMMON_CPPFLAGS) $(CPPFLAGS) $(COMMON_CFLAGS) $(CFLAGS) -o $@ -c $<
+	$(_CC) $(COMMON_CPPFLAGS) $(CPPFLAGS) $(COMMON_CFLAGS) $(CFLAGS_$(<:src/%.c=%)) $(CFLAGS) -o $@ -c $<
 
 %.o: %.S Makefile common.mk config.mk project.mk
-	$(_CC) $(COMMON_CPPFLAGS) $(CPPFLAGS) $(COMMON_CFLAGS) $(CFLAGS) -o $@ -c $<
+	$(_CC) $(COMMON_CPPFLAGS) $(CPPFLAGS) $(COMMON_CFLAGS) $(CFLAGS_$(<:src/%.c=%)) $(CFLAGS) -o $@ -c $<
 
 %.lo: %.c Makefile common.mk config.mk project.mk
-	$(_CC) $(COMMON_CPPFLAGS) $(CPPFLAGS) $(COMMON_CFLAGS) $(CFLAGS) $(CFLAGS_SHARED) -o $@ -c $<
+	$(_CC) $(COMMON_CPPFLAGS) $(CPPFLAGS) $(COMMON_CFLAGS) $(CFLAGS_$(<:src/%.c=%)) $(CFLAGS) $(CFLAGS_SHARED) -o $@ -c $<
 
 lib%.a:
 	$(_AR) $(AR) rc $@ $^