1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
PREFIX := /usr/local
ZFLAGS := -I. --release-small --strip --single-threaded
CFLAGS := -Wall -Wextra -Wpedantic -Os -std=c11
SRC := $(if $(ZIG),iboot.zig,iboot.c)
iboot: $(SRC) config.h
ifneq ($(ZIG),)
zig build-exe $(ZFLAGS) --name $@ $<
else
$(CC) $(CFLAGS) -o $@ $<
endif
config.h: config.def.h
cp $< $@
install:
install -m 0755 iboot $(PREFIX)/bin/
clean:
rm -rf iboot iboot.o