29 lines
687 B
Makefile
29 lines
687 B
Makefile
FILES = $(wildcard ./*)
|
|
SRCS = $(filter %.c,$(FILES))
|
|
BINS = $(SRCS:%.c=%.elf)
|
|
|
|
MUSLFILES = $(wildcard ./musl/*)
|
|
MUSLSRCS = $(filter %.s,$(MUSLFILES))
|
|
MUSLOBJS = $(MUSLSRCS:%.s=%.o)
|
|
|
|
CFLAGS = -Wall -Werror -pedantic -Wno-unused -std=gnu2y\
|
|
-O3 -c -g -fno-stack-protector -fno-pie\
|
|
-fno-semantic-interposition -fno-trapping-math\
|
|
-march=x86-64 -mprefer-vector-width=128 -mpopcnt -malign-data=compat -malign-stringops
|
|
|
|
LFLAGS = -Ttext=C475000 -static -nostdlib -no-pie
|
|
|
|
all: $(BINS)
|
|
|
|
%.elf: %.o start.o | %.c lib.h $(MUSLOBJS)
|
|
ld -o $@ $(LFLAGS) start.o $< $(MUSLOBJS)
|
|
|
|
start.o: start.s
|
|
nasm -f elf64 -o $@ $<
|
|
|
|
%.o: %.c
|
|
gcc-tree -o $@ $(CFLAGS) $<
|
|
|
|
clean:
|
|
rm -f *.elf *.o
|