prefix = /usr/local exec_prefix = $(prefix) bindir = $(exec_prefix)/bin sharedir = $(prefix)/share/saturn-tools CFLAGS = -Os -pipe -std=c99 -D_POSIX_C_SOURCE=200809L LDFLAGS = SATURN_CROSS = saturn- SATURN_CC = $(SATURN_CROSS)gcc -m2 -mb SATURN_OBJCOPY = $(SATURN_CROSS)objcopy SATURN_CFLAGS = -Os -pipe -std=c99 -nostdlib SATURN_LDFLAGS = INSTALL = ./tools/install.sh -include config.mak BOOTSRCS = $(sort $(wildcard boot/*.c)) BOOTELFS = $(patsubst %.c,%.elf,$(BOOTSRCS)) BOOTBINS = $(patsubst boot/%.c,share/boot/%,$(BOOTSRCS)) SRCS = $(sort $(wildcard src/*.c)) DATA = $(sort $(wildcard src/*.bin)) OBJS = $(SRCS:.c=.o) $(DATA:.bin=.o) BINS = bin/saturn-mkboot bin/saturn-mkiso .PHONY: all clean install install-bins install-data all: $(BINS) $(BOOTBINS) install: install-bins install-data clean: rm -f $(BINS) $(OBJS) $(BOOTBINS) $(BOOTELFS) bin/saturn-mkboot: src/securitycode.o src/symbols.o bin/%: src/%.o $(CC) $(LDFLAGS) $^ -o $@ share/boot/%: boot/%.elf $(SATURN_OBJCOPY) -O binary $< $@ %.elf: %.c boot/ldscript $(SATURN_CC) $(SATURN_CFLAGS) $(SATURN_LDFLAGS) -T boot/ldscript $< -o $@ %.c: %.bin tools/bin2c $< > $@ %.o: %.c $(CC) $(CFLAGS) -c $< -o $@ src/saturn-mkboot.o: src/paths.h src/paths.h: config.mak echo "#define DATA_PATH \"$(sharedir)\"" > $@ $(DESTDIR)$(bindir)/%: bin/% $(INSTALL) -D $< $@ $(DESTDIR)$(sharedir)/%: share/% $(INSTALL) -D -m 644 $< $@ install-bins: $(BINS:bin/%=$(DESTDIR)$(bindir)/%) install-data: $(BOOTBINS:share/%=$(DESTDIR)$(sharedir)/%)