From bf59515a9e248675c07d5edf623856a15d808901 Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Wed, 8 May 2013 23:27:58 +0200
Subject: [PATCH] Added support for building 'extra' object files.
---
libsrc/Makefile | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/libsrc/Makefile b/libsrc/Makefile
index a37abc98a..6208d37b9 100644
--- a/libsrc/Makefile
+++ b/libsrc/Makefile
@@ -125,6 +125,10 @@ OBJS := $(addprefix ../wrk/$(TARGET)/,$(sort $(notdir $(OBJS))))
DEPS = $(OBJS:.o=.d)
+EXTRA_SRCPAT = $(firstword $(DIRS))/extra/%.s
+EXTRA_OBJPAT = ../lib/$(TARGET)-%.o
+EXTRA_OBJS := $(patsubst $(EXTRA_SRCPAT),$(EXTRA_OBJPAT),$(wildcard $(firstword $(DIRS))/extra/*.s))
+
ZPOBJ = ../wrk/$(TARGET)/zeropage.o
ifeq ($(TARGET),$(filter $(TARGET),$(EXTZP)))
ZPOBJ += ../wrk/$(TARGET)/extzp.o
@@ -199,13 +203,17 @@ LD = $(if $(wildcard ../bin/ld65*),../bin/ld65,ld65)
../wrk/$(TARGET):
@$(call MKDIR,$@)
+$(EXTRA_OBJPAT): $(EXTRA_SRCPAT) | ../lib
+ @echo $(TARGET) - $<
+ @$(CA) -t $(TARGET) $(AFLAGS) -o $@ $<
+
../lib/$(TARGET).lib: $(OBJS) | ../lib
$(AR) a $@ $?
../lib:
@$(call MKDIR,$@)
-$(TARGET): ../lib/$(TARGET).lib
+$(TARGET): $(EXTRA_OBJS) ../lib/$(TARGET).lib
-include $(DEPS)
--
2.39.5