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 SRCALL
= $(SRC
) $(AMD64SRC
) $(ARM64SRC
)
12 AMD64OBJ
= $(AMD64SRC
:%.c
=$(OBJDIR
)/%.o
)
13 ARM64OBJ
= $(ARM64SRC
:%.c
=$(OBJDIR
)/%.o
)
14 OBJ
= $(SRC
:%.c
=$(OBJDIR
)/%.o
) $(AMD64OBJ
) $(ARM64OBJ
)
16 CFLAGS
+= -Wall
-Wextra
-std
=c99
-g
-pedantic
18 $(OBJDIR
)/$(BIN
): $(OBJ
) $(OBJDIR
)/timestamp
19 @
test -z
"$(V)" || echo
"ld $@"
20 $(V
)$(CC
) $(LDFLAGS
) $(OBJ
) -o
$@
22 $(OBJDIR
)/%.o
: %.c
$(OBJDIR
)/timestamp
23 @
test -z
"$(V)" || echo
"cc $<"
24 $(V
)$(CC
) $(CFLAGS
) -c
$< -o
$@
28 @mkdir
-p
$(OBJDIR
)/amd64
29 @mkdir
-p
$(OBJDIR
)/arm64
33 $(AMD64OBJ
): amd64
/all.h
34 $(ARM64OBJ
): arm64
/all.h
35 $(OBJDIR
)/main.o
: config.h
40 echo
"#define Defasm Gasmacho"; \
41 echo
"#define Deftgt T_amd64_sysv"; \
44 echo
"#define Defasm Gaself"; \
47 echo
"#define Deftgt T_arm64"; \
50 echo
"#define Deftgt T_amd64_sysv";\
56 install: $(OBJDIR
)/$(BIN
)
57 mkdir
-p
"$(DESTDIR)/$(PREFIX)/bin/"
58 cp
$< "$(DESTDIR)/$(PREFIX)/bin/"
61 rm -f
"$(DESTDIR)/$(PREFIX)/bin/$(BIN)"
69 check: $(OBJDIR
)/$(BIN
)
72 check-arm64
: $(OBJDIR
)/$(BIN
)
73 TARGET
=arm64 tools
/test.sh
all
79 @for F in
$(SRCALL
); \
83 if (length(\$$0) > $@) \
84 printf(\"$$F:%d: %s\\n\", NR, \$$0); \
88 .PHONY
: clean clean-gen
check check-arm64 src
80 install uninstall