aboutsummaryrefslogtreecommitdiff
path: root/tests/test.mk
blob: c05a72b9b3974c928aef652d249bd36f2cd97ec3 (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
MAKEFLAGS += --no-builtin-rules

# 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