summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 6697fc6a291c50d8a9f831ac0cd040e9d0156616 (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
35
36
37
38
39
include config.mk

CFILES := $(wildcard *.c)
CFILES += $(wildcard */*.c)
CFILES += $(wildcard boot/$(TARGET_BOOTLOADER)/*.c)
CFILES += $(wildcard arch/$(TARGET_MACHINE)/*.c)
CFILES += $(wildcard arch/$(TARGET_MACHINE)/*/*.c)

SFILES := $(wildcard *.S)
SFILES += $(wildcard */*.S)
SFILES += $(wildcard arch/$(TARGET_MACHINE)/*.S)
SFILES += $(wildcard arch/$(TARGET_MACHINE)/*/*.S)

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

DFILES := $(wildcard *.d)
DFILES += $(wildcard */*.d)
DFILES += $(wildcard arch/$(TARGET_MACHINE)/*.d)
DFILES += $(wildcard arch/$(TARGET_MACHINE)/*/*.d)

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 $@