blob: d6a66ccadd7421cd67fad4f6d0c7d49d44c54ea6 (
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
MAKEFLAGS += --no-builtin-rules
MIPS_PREFIX = mips-elf-
# Output path
O ?= .
#MIPS_CFLAGS += -Wall
MIPS_LDFLAGS += -nostdlib -nodefaultlibs -nostartfiles -Wl,-Ttext,0x80020000
.PHONY: all
all::
@
.PHONY: clean
clean::
@
define MIPS_ELF
ifndef MIPS_PREFIX
$$(error Toolchain prefix have to be passed in MIPS_PREFIX variable)
endif
OBJ_$(1):=$$(patsubst %.S,$$(O)/%.o,$$(SRC_$(1)))
$$(info $$(OBJ_$(1)))
all:: $$(O)/$(1)
$$(O)/$(1): $$(OBJ_$(1))
$$(MIPS_PREFIX)gcc $$(MIPS_LDFLAGS) -o $$@ $$^
$$(OBJ_$(1)): $$(O)/%.o: %.S
$$(MIPS_PREFIX)gcc $$(MIPS_CFLAGS) -c -x assembler-with-cpp -o $$@ $$<
clean::
$(RM) $$(OBJ_$(1))
$(RM) $$(O)/$(1)
endef
|