summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 84244de738cb4e421ccac28074377422e0fa86a9 (plain) (blame)
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
26
27
28
29
30
31
32
33
34
include config.mk

CDIRS := boot device initrd klib memory task syscall
CDIRS += memory/alloc
CDIRS += boot/$(TARGET_BOOTLOADER)
CDIRS += arch/$(TARGET_MACHINE)

CFILES := $(wildcard *.c)
CFILES += $(foreach dir, $(CDIRS), $(wildcard $(dir)/*.c))

SFILES := $(wildcard *.S)
SFILES += $(foreach dir, $(CDIRS), $(wildcard $(dir)/*.S))

OBJFILES := $(patsubst %.c,%.o,$(CFILES))
OBJFILES += $(patsubst %.S,%.o,$(SFILES))

BIN := jove.elf

all: $(BIN)

.PHONY: clean
clean:
	rm $(OBJFILES)
	rm $(DFILES)
	rm $(BIN)

$(BIN): ${OBJFILES}
	$(LD) $(LDFLAGS) ${OBJFILES} -o $(BIN)

%.o:%.c
	$(CC) $(CFLAGS) -c $< -o $@

%.o:%.S
	$(AS) -g -c $< -o $@