diff options
| author | Roberto E. Vargas Caballero <roberto.vargas@midokura.com> | 2022-06-29 09:50:53 +0200 |
|---|---|---|
| committer | Quentin Carbonneaux <quentin@c9x.me> | 2022-07-01 13:17:09 +0200 |
| commit | 9b4bb8d2243b3af477a13fc61e9b7c0406a6bc33 (patch) | |
| tree | f84dcca6f9d96126bf6d264cf60c499a4ded2bd1 | |
| parent | 790aedb8fef1164bcfe262b566fc58dd665edf9c (diff) | |
| download | roux-9b4bb8d2243b3af477a13fc61e9b7c0406a6bc33.tar.gz | |
Makefile: Avoid double macro expansion in targets
POSIX specification stays:
string1 = [string2]
...
Macro expansions in string1 of macro definition lines shall
be evaluated when read. Macro expansions in string2 of macro
definition lines shall be performed when the macro identified
by string1 is expanded in a rule or command.
It means that recursive macro expansion is not guaranteed to work in
a portable Make. Also, as make is a declarative language makes more
sense to declare your targets as a primary concern instead of
derivating them from a informational macro like SRC that is only
used in a rule command.
| -rw-r--r-- | Makefile | 19 |
1 files changed, 8 insertions, 11 deletions
@@ -4,17 +4,14 @@ PREFIX = /usr/local BINDIR = $(PREFIX)/bin -SRC = main.c util.c parse.c cfg.c mem.c ssa.c alias.c load.c copy.c \ - fold.c live.c spill.c rega.c gas.c -AMD64SRC = amd64/targ.c amd64/sysv.c amd64/isel.c amd64/emit.c -ARM64SRC = arm64/targ.c arm64/abi.c arm64/isel.c arm64/emit.c -RV64SRC = rv64/targ.c rv64/abi.c rv64/isel.c rv64/emit.c -SRCALL = $(SRC) $(AMD64SRC) $(ARM64SRC) $(RV64SRC) - -AMD64OBJ = $(AMD64SRC:.c=.o) -ARM64OBJ = $(ARM64SRC:.c=.o) -RV64OBJ = $(RV64SRC:.c=.o) -OBJ = $(SRC:.c=.o) $(AMD64OBJ) $(ARM64OBJ) $(RV64OBJ) +COMMOBJ = main.o util.o parse.o cfg.o mem.o ssa.o alias.o load.o copy.o \ + fold.o live.o spill.o rega.o gas.o +AMD64OBJ = amd64/targ.o amd64/sysv.o amd64/isel.o amd64/emit.o +ARM64OBJ = arm64/targ.o arm64/abi.o arm64/isel.o arm64/emit.o +RV64OBJ = rv64/targ.o rv64/abi.o rv64/isel.o rv64/emit.o +OBJ = $(COMMOBJ) $(AMD64OBJ) $(ARM64OBJ) $(RV64OBJ) + +SRCALL = $(OBJ:.o=.c) CFLAGS = $(CPPFLAGS) -Wall -Wextra -std=c99 -g -Wpedantic |
