-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelf.mk
44 lines (32 loc) · 1002 Bytes
/
elf.mk
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
cur_makefile := $(abspath $(lastword $(MAKEFILE_LIST)))
PWD := $(patsubst %/,%,$(dir $(cur_makefile)))
include $(PWD)/config.mk
LINKSCRIPTS := -T$(PWD)/.build/memory.ld \
-T$(PWD)/include/n64/n64.ld \
-T$(PWD)/include/$(GAME)/$(GAME)-$(VERSION).ld
SYMFILE := $(BUILDDIR)/symbols.sym
OUTPUT := $(BUILDDIR)/$(NAME).elf
CFILES := $(wildcard $(PWD)/$(NAME)/*.c)
SFILES := $(wildcard $(PWD)/$(NAME)/*.s)
OBJS ?= $(CFILES:.c=.o) $(SFILES:.s=.o)
N64LIB := $(PWD)/include/n64/lib
OBJS += $(N64LIB)/64drive/64drive.o \
$(N64LIB)/libc/libc.o \
$(N64LIB)/rawio/rawio.o
.PHONY: all clean
all: $(OUTPUT)
@echo done
clean:
$(DELETE) .build
$(OUTPUT): $(OBJS)
@echo " * Linking: $(notdir $(OBJS))"
$(call LINK, $(OBJS), $(OUTPUT))
$(BUILDDIR)/%.o: $(SRCDIR)/%.c
@echo " * Compiling: $<"
$(call COMPILE, $<, $@)
$(BUILDDIR)/%.o: $(SRCDIR)/%.s
@echo " * Assembling: $<"
$(call ASSEMBLE, $<, $@)
$(BUILDDIR)/lib/%.o: $(PWD)/include/n64/lib/%.c
@echo " * Compiling: $<"
$(call COMPILE, $<, $@)