# $Id$
-DESTDIR=
-prefix=/opt/sat
+ifndef prefix
+prefix=/opt/cortex
+endif
+
libdir=$(prefix)/lib
bindir=$(prefix)/bin
includedir=$(prefix)/include
CPU=none
BUILD=build-$(CPU)
-CC=$(bindir)/arm-none-eabi-gcc
+#CC=$(bindir)/arm-none-eabi-gcc
+CC=/usr/bin/arm-none-eabi-gcc
# This is where you chose which platform to compile for (see 'make links' / './platform')
PLATFORM := altos
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
-PDCLIB=pdclib-$(CPU).a
+PDCLIBNAME=libpdclib
+PDCLIB=$(PDCLIBNAME)-$(CPU).a
all:
- +for i in $(CPUS); do make CPU=$$i links pdclib-$$i.a; done
+ +for i in $(CPUS); do make CPU=$$i links $(PDCLIBNAME)-$$i.a; done
install: install-hdr
- +for i in $(CPUS); do make CPU=$$i install-lib-$$i; done
+ @echo '######' install
+ +for i in $(CPUS); do make CPU=$$i prefix=$(prefix) install-lib-$$i; done
install-hdr:
- +make CPU=$(FIRSTCPU) install-hdr-$(FIRSTCPU)
+ @echo '######' install-hdr
+ +make CPU=$(FIRSTCPU) prefix=$(prefix) install-hdr-$(FIRSTCPU)
+
+clean:
+ +for i in $(CPUS); do make CPU=$$i clean-$$i; rm -rf build-$$i; done
check: all testdrivers regtestdrivers
@echo
@echo
install-$(CPU): install-$(CPU)-lib install-hdr
+ @echo '######' install-$(CPU)
-install-lib-$(CPU): $(BUILD) $(PDCLIB)
+install-lib-$(CPU): $(PDCLIB)
+ @echo '######' install-lib-$(CPU)
install -D -c $(PDCLIB) $(DESTDIR)$(libdir)/$(PDCLIB)
install-hdr-$(CPU): $(BUILD) $(BUILDHDRFILES)
+ @echo '######' install-hdr-$(CPU)
for file in $(BUILDHDRFILES); do \
- install -D -c $$file $(DESTDIR)$(includedir)/.; \
+ install -m 0444 -D -c $$file $(DESTDIR)$(includedir)/.; \
done
test: functions/$(FILE)
-include $(DEPFILES) $(TSTDEPFILES) $(REGDEPFILES)
-clean: $(BUILD)
+clean-$(CPU): $(BUILD)
-@$(RM) $(wildcard $(OBJFILES) $(DEPFILES) $(TSTFILES) $(TSTDEPFILES) $(REGFILES) $(REGDEPFILES) $(PDCLIB) pdclib.tgz scanf_testdata_*)
srcdist:
@echo "(Usage: USERFLAGS=\"flags\" make [...])."
%.o: %.c Makefile
- echo " CC $(patsubst functions/%,%,$@)"
- $(CC) $(CFLAGS) -MMD -MP -I./$(BUILD)/includes -c $< -o $@
+ @echo " CC $(patsubst functions/%,%,$@)"
+ @$(CC) $(CFLAGS) -MMD -MP -I./$(BUILD)/includes -c $< -o $@
%_t: %.c Makefile $(PDCLIB)
@echo " CC $(patsubst functions/%,%,$@)"
@$(CC) $(CFLAGS) -MMD -MP -DTEST -DREGTEST $< -o $@
$(BUILD):
- mkdir -p $(BUILD)
\ No newline at end of file
+ mkdir -p $(BUILD)