-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
41 lines (32 loc) · 1.03 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
# Building MIPS ElF binaries
# @author Alexander Titov <[email protected]>
# Copyright 2012-2018 uArchSim iLab Project
# create a list of all assembly files in the current folder
ASM_FILES = $(wildcard *.s)
# using names of the assembly files create a list of output
# execution files
OUT_FILES= $(patsubst %.s,%.out,$(ASM_FILES))
TT_FILES= $(wildcard tt.*.s)
OUT_TT_FILES= $(patsubst %.s,%.out,$(TT_FILES))
MIPS_AS?=mips-linux-gnu-as
MIPS_LD?=mips-linux-gnu-ld
# assemble all the object files
build_all: $(OUT_FILES)
tt: $(OUT_TT_FILES) smc.out fib.out
%.out: %.o
@$(MIPS_LD) $< -o $@ -EL
@chmod -x $@
@echo $@ is built
%.o: %.s
@$(MIPS_AS) $< -o $@ -O0 -mips64 -no-break -EL -g
# it is needed to preven make from
# deleting .o files automatically
.PRECIOUS: %.o
.PHONY: clean
clean:
-rm *.o *.out -rf
.PHONY: help
help:
@echo " This makefile build all MIPS assembly files in the directory."
@echo " To do that just type 'make' or 'make build_all'."
@echo " Note that assembly files should have '.s' extension."