Actually use $(CPU) when building object files. Add clean target.
[fw/pdclib] / Makefile
index 84e3393f18ad406237f4c68e5c3c8b166ba46b42..2fd87477b7391875f302e0b3c08d9cd10f9f0720 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -46,7 +46,7 @@ REGDEPFILES := $(patsubst %,%.d,$(REGFILES))
 ALLFILES := $(SRCFILES) $(HDRFILES) $(AUXFILES)
 
 WARNINGS := -Wall -Wextra -pedantic -Wno-unused-parameter -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -Wno-long-long -Wuninitialized -Wstrict-prototypes 
-PLATFORM_FLAGS=-nostdinc -mlittle-endian -mthumb -mcpu=cortex-m3 -ffreestanding -nostdlib
+PLATFORM_FLAGS=-nostdinc -mlittle-endian -mthumb -mcpu=$(CPU) -ffreestanding -nostdlib
 CFLAGS := -fno-builtin -Os -g -std=c99 -I./$(BUILD)/internals -I./testing $(WARNINGS) $(USERFLAGS) $(PLATFORM_FLAGS)
 
 .PHONY: all clean srcdist bindist test tests testdrivers regtests regtestdrivers todos fixmes find links unlink help
@@ -62,6 +62,9 @@ install: install-hdr
 install-hdr:
        +make CPU=$(FIRSTCPU) install-hdr-$(FIRSTCPU)
 
+clean:
+       +for i in $(CPUS); do make CPU=$$i clean-$$i; done
+
 check: all testdrivers regtestdrivers
        @echo
        @echo "========================"
@@ -108,7 +111,7 @@ regtestdrivers: $(REGFILES)
 
 -include $(DEPFILES) $(TSTDEPFILES) $(REGDEPFILES)
 
-clean: $(BUILD)
+clean-$(CPU): $(BUILD)
        -@$(RM) $(wildcard $(OBJFILES) $(DEPFILES) $(TSTFILES) $(TSTDEPFILES) $(REGFILES) $(REGDEPFILES) $(PDCLIB) pdclib.tgz scanf_testdata_*)
 
 srcdist: