-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (35 loc) · 1.25 KB
/
Makefile
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
40
41
42
43
44
45
46
47
48
ifndef WONDERFUL_TOOLCHAIN
$(error Please define WONDERFUL_TOOLCHAIN to point to the location of the Wonderful toolchain.)
endif
include $(WONDERFUL_TOOLCHAIN)/i8086/wswan.mk
TARGET := $(notdir $(shell pwd)).ws
OBJDIR := obj
RESDIR := res
SRCDIRS := src
MKDIRS := $(OBJDIR)
LIBS := -lws -lc -lgcc
CFLAGS += -O2
CSOURCES := $(foreach dir,$(SRCDIRS),$(notdir $(wildcard $(dir)/*.c)))
ASMSOURCES := $(foreach dir,$(SRCDIRS),$(notdir $(wildcard $(dir)/*.S)))
OBJECTS := $(CSOURCES:%.c=$(OBJDIR)/%.o) $(ASMSOURCES:%.S=$(OBJDIR)/%.o)
CFLAGS += -I$(OBJDIR)
DEPS := $(OBJECTS:.o=.d)
CFLAGS += -MMD -MP
vpath %.c $(SRCDIRS)
vpath %.S $(SRCDIRS)
.PHONY: all clean install
all: $(TARGET)
$(TARGET): $(OBJECTS) $(OBJDIR)/fs.bin
$(SWANLINK) -v -o $@ -a $(OBJDIR)/fs.bin --output-elf $@.elf --rom-size 2 --ram-type SRAM_8KB --unlock-ieep --disable-custom-bootsplash --color --linker-args $(LDFLAGS) $(WF_CRT0) $(OBJECTS) $(LIBS)
$(OBJDIR)/fs.bin: $(RESDIR)/8x8.chr | $(OBJDIR)
$(FSBANKPACK) -v -o $@ $^
$(OBJDIR)/%.o: %.c $(OBJDIR)/fs.bin | $(OBJDIR)
$(CC) $(CFLAGS) -c -o $@ $<
$(OBJDIR)/%.o: %.S $(OBJDIR)/fs.bin | $(OBJDIR)
$(CC) $(CFLAGS) -c -o $@ $<
$(OBJDIR):
$(info $(shell mkdir -p $(MKDIRS)))
clean:
rm -r $(OBJDIR)/*
rm $(TARGET) $(TARGET).elf
-include $(DEPS)