aboutsummaryrefslogtreecommitdiff
path: root/src/Makefile
blob: 4fa31a147e01f95814ba2cfc76c266fecf1886b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
EXEC := bringelle
CC := gcc -c -m32 -fno-pie -fno-builtin -fno-stack-protector

BOOT_OBJ := $(addsuffix .o,$(basename $(shell find ./boot -name "*.[c|S]")))
UTILS_OBJ := $(addsuffix .o,$(basename $(shell find ./utils -name "*.[c|S]")))

all: $(EXEC)

$(EXEC): $(BOOT_OBJ) $(UTILS_OBJ) bringelle.o
	ld -Ttext=0x00100000 -melf_i386 -nostdlib --oformat=binary -o bringelle $^ 

%.o: %.S
	as --32 -o $@ $^ -mx86-used-note=no

%.o: %.c
	$(CC) -o $@ $<
	objcopy --remove-section .note.gnu.property $@

clean:
	rm -f $(EXEC)
	find ./ -name "*.o" -delete

.PHONY: clean