6 SRC
= main.c util.c parse.c cfg.c mem.c ssa.c alias.c load.c copy.c \
7 fold.c live.c spill.c rega.c gas.c
8 AMD64SRC
= amd64
/targ.c amd64
/sysv.c amd64
/isel.c amd64
/emit.c
9 ARM64SRC
= arm64
/targ.c arm64
/abi.c arm64
/isel.c arm64
/emit.c
10 RV64SRC
= rv64
/targ.c rv64
/abi.c rv64
/isel.c rv64
/emit.c
11 SRCALL
= $(SRC
) $(AMD64SRC
) $(ARM64SRC
) $(RV64SRC
)
13 AMD64OBJ
= $(AMD64SRC
:%.c
=$(OBJDIR
)/%.o
)
14 ARM64OBJ
= $(ARM64SRC
:%.c
=$(OBJDIR
)/%.o
)
15 RV64OBJ
= $(RV64SRC
:%.c
=$(OBJDIR
)/%.o
)
16 OBJ
= $(SRC
:%.c
=$(OBJDIR
)/%.o
) $(AMD64OBJ
) $(ARM64OBJ
) $(RV64OBJ
)
18 CFLAGS
+= -Wall
-Wextra
-std
=c99
-g
-pedantic
20 $(OBJDIR
)/$(BIN
): $(OBJ
) $(OBJDIR
)/timestamp
21 @
test -z
"$(V)" || echo
"ld $@"
22 $(V
)$(CC
) $(LDFLAGS
) $(OBJ
) -o
$@
24 $(OBJDIR
)/%.o
: %.c
$(OBJDIR
)/timestamp
25 @
test -z
"$(V)" || echo
"cc $<"
26 $(V
)$(CC
) $(CFLAGS
) -c
$< -o
$@
30 @mkdir
-p
$(OBJDIR
)/amd64
31 @mkdir
-p
$(OBJDIR
)/arm64
32 @mkdir
-p
$(OBJDIR
)/rv64
36 $(AMD64OBJ
): amd64
/all.h
37 $(ARM64OBJ
): arm64
/all.h
38 $(RV64OBJ
): rv64
/all.h
39 $(OBJDIR
)/main.o
: config.h
44 echo
"#define Defasm Gasmacho"; \
45 echo
"#define Deftgt T_amd64_sysv"; \
48 echo
"#define Defasm Gaself"; \
51 echo
"#define Deftgt T_arm64"; \
54 echo
"#define Deftgt T_rv64"; \
57 echo
"#define Deftgt T_amd64_sysv";\
63 install: $(OBJDIR
)/$(BIN
)
64 mkdir
-p
"$(DESTDIR)/$(PREFIX)/bin/"
65 cp
$< "$(DESTDIR)/$(PREFIX)/bin/"
68 rm -f
"$(DESTDIR)/$(PREFIX)/bin/$(BIN)"
76 check: $(OBJDIR
)/$(BIN
)
79 check-arm64
: $(OBJDIR
)/$(BIN
)
80 TARGET
=arm64 tools
/test.sh
all
82 check-rv64
: $(OBJDIR
)/$(BIN
)
83 TARGET
=rv64 tools
/test.sh
all
89 @for F in
$(SRCALL
); \
93 if (length(\$$0) > $@) \
94 printf(\"$$F:%d: %s\\n\", NR, \$$0); \
98 .PHONY
: clean clean-gen
check check-arm64 src
80 install uninstall