Welcome to little lamb

Code » comain » commit ff169d0

common.mk: Handle .S files as asm sources

author Olivier Brunel
2023-01-25 22:45:33 UTC
committer Olivier Brunel
2023-01-25 23:03:17 UTC
parent b898e060e98b319c3432697b0d63fff62efde3e6

common.mk: Handle .S files as asm sources

common.mk +7 -3

diff --git a/common.mk b/common.mk
index b1526ef..a33832a 100644
--- a/common.mk
+++ b/common.mk
@@ -15,10 +15,11 @@ COMMON_LDFLAGS   = -Wl,--sort-section=alignment -Wl,--sort-common
 CFLAGS_SHARED    = -fPIC
 LDFLAGS_SHARED   = -shared -Wl,--hash-style=gnu
 
-SRCS  = $(wildcard src/*.c)
-OBJS  = $(SRCS:.c=.o)
+SRCS  = $(wildcard src/*.c src/*/*.c)
+ASMS  = $(wildcard src/*.S src/*/*.S)
+OBJS  = $(SRCS:.c=.o) $(ASMS:.S=.o)
 OBJS += $(SRCS:.c=.lo)
-DEPS  = $(SRCS:.c=.d)
+DEPS  = $(SRCS:.c=.d) $(ASMS:.S=.d)
 BINS  =
 LIBS  =
 SHARED_LIBS = $(patsubst %,lib%.so,$(LIBS))
@@ -33,6 +34,9 @@ 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 $<
 
+%.o: %.S Makefile common.mk config.mk project.mk
+	$(_CC) $(COMMON_CPPFLAGS) $(CPPFLAGS) $(COMMON_CFLAGS) $(CFLAGS) -o $@ -c $<
+
 %.lo: %.c Makefile common.mk config.mk project.mk
 	$(_CC) $(COMMON_CPPFLAGS) $(CPPFLAGS) $(COMMON_CFLAGS) $(CFLAGS) $(CFLAGS_SHARED) -o $@ -c $<