From 5768486ac0d07947bc1ad9a42c189d4a01423168 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 21 Dec 2021 12:22:11 +0100 Subject: [PATCH] Add support for compiling assembly files. --- common/src-from-vcxproj.mk | 3 +++ common/unix.mk | 21 ++++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/common/src-from-vcxproj.mk b/common/src-from-vcxproj.mk index 8e3d04e8..3a16b197 100644 --- a/common/src-from-vcxproj.mk +++ b/common/src-from-vcxproj.mk @@ -4,6 +4,7 @@ SRC := $(SRC) SRC2 := $(SRC2) SRC3 := $(SRC3) +SRC4 := $(SRC4) # Paths here are relative to the directory in which make was invoked, not to # this file, so ../win32/$(PROJECT).vcxproj refers to the Visual Studio project @@ -11,8 +12,10 @@ SRC3 := $(SRC3) BASE := $(shell egrep 'ClCompile.*cpp"' ../win32/$(PROJECT).vcxproj | sed -e 's/.*\"\(.*\)\".*/\1/' | sed -e 's@\\@/@g') BASE2 := $(shell egrep 'ClCompile.*c"' ../win32/$(PROJECT).vcxproj | sed -e 's/.*\"\(.*\)\".*/\1/' | sed -e 's@\\@/@g') +BASE4 := $(shell egrep 'None.*S"' ../win32/$(PROJECT).vcxproj | sed -e 's/.*\"\(.*\)\".*/\1/' | sed -e 's@\\@/@g') # The tool-specific makefile may request that certain files be omitted. SRC += $(filter-out $(FILTER),$(BASE)) SRC2 += $(filter-out $(FILTER),$(BASE2)) SRC3 += $(filter-out $(FILTER),$(BASE3)) +SRC4 += $(filter-out $(FILTER),$(BASE4)) diff --git a/common/unix.mk b/common/unix.mk index 8b78e301..0105093b 100644 --- a/common/unix.mk +++ b/common/unix.mk @@ -20,6 +20,7 @@ OBJDIR := $(OBJDIRBASE)/o/o/o OBJ := $(addprefix $(OBJDIR)/,$(SRC:%.cpp=%.o)) OBJ2 := $(addprefix $(OBJDIR)/,$(SRC2:%.c=%.o)) OBJ3 := $(addprefix $(OBJDIR)/,$(SRC3:%.m=%.o)) +OBJ4 := $(addprefix $(OBJDIR)/,$(SRC4:%.S=%.o)) all: $(IMAGE) @@ -53,16 +54,26 @@ $(OBJDIR)/%.d : %.m sed 's,.*\.o[ :]*,$(OBJDIR)/$(<:.m=.o) $@ : ,g' < $@.$$$$ > $@; \ rm -f $@.$$$$ +$(OBJDIR)/%.o: %.S + $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ + +$(OBJDIR)/%.d : %.S + @echo Resolving dependencies of $< + @mkdir -p $(@D) + @$(CC) -MM $(INCLUDES) $(CFLAGS) $(DEFINES) $< > $@.$$$$; \ + sed 's,.*\.o[ :]*,$(OBJDIR)/$(<:.m=.o) $@ : ,g' < $@.$$$$ > $@; \ + rm -f $@.$$$$ + ifeq (yes,$(SHARED_LIBRARY)) -$(IMAGE): $(OBJ) $(OBJ2) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(DEFINES) $(OBJ) $(OBJ2) $(LIBS) -shared -o $@ +$(IMAGE): $(OBJ) $(OBJ2) $(OBJ4) + $(CXX) $(CXXFLAGS) $(LDFLAGS) $(DEFINES) $(OBJ) $(OBJ2) $(OBJ4) $(LIBS) -shared -o $@ else -$(IMAGE): $(OBJ) $(OBJ2) $(OBJ3) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(DEFINES) $(OBJ) $(OBJ2) $(OBJ3) $(LIBS) -o $@ +$(IMAGE): $(OBJ) $(OBJ2) $(OBJ3) $(OBJ4) + $(CXX) $(CXXFLAGS) $(LDFLAGS) $(DEFINES) $(OBJ) $(OBJ2) $(OBJ3) $(OBJ4) $(LIBS) -o $@ endif ifneq "$(MAKECMDGOALS)" "clean" --include $(addprefix $(OBJDIR)/,$(SRC:.cpp=.d)) $(addprefix $(OBJDIR)/,$(SRC2:.c=.d)) $(addprefix $(OBJDIR)/,$(SRC3:.m=.d)) +-include $(addprefix $(OBJDIR)/,$(SRC:.cpp=.d)) $(addprefix $(OBJDIR)/,$(SRC2:.c=.d)) $(addprefix $(OBJDIR)/,$(SRC3:.m=.d)) $(addprefix $(OBJDIR)/,$(SRC4:.S=.d)) endif clean: