Argument order matters

This commit is contained in:
Alex D. 2023-12-08 19:58:57 +00:00
parent ebea2b2a0d
commit f7ad6580ee
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
2 changed files with 4 additions and 4 deletions

View File

@ -5,13 +5,13 @@ OBJ := $(SRC:.c=.o)
all: $(OBJ) $(OUT) all: $(OBJ) $(OUT)
%.o: %.c %.o: %.c
$(CC) -o $@ -c $(CFLAGS) $< $(CC) $< -c $(CFLAGS) -o "$@"
clean: clean:
rm -f $(OBJ) $(OUT) rm -f $(OBJ) $(OUT)
ifneq ($(OUT),) ifneq ($(OUT),)
$(OUT): $(OBJ) $(OUT): $(OBJ)
$(CC) -o "$@" $(LDFLAGS) $^ $(CC) $^ $(LDFLAGS) -o "$@"
endif endif
.PHONY: all clean .PHONY: all clean

View File

@ -5,14 +5,14 @@ OBJ = ${SRC:.cpp=.o}
all: ${OBJ} ${OUT} all: ${OBJ} ${OUT}
%.o: %.cpp %.o: %.cpp
${CXX} -o $@ -c ${CXXFLAGS} $< ${CXX} $< -c ${CXXFLAGS} -o "$@"
clean: clean:
rm -f ${OBJ} ${OUT} rm -f ${OBJ} ${OUT}
ifneq (${OUT},) ifneq (${OUT},)
${OUT}: ${OBJ} ${OUT}: ${OBJ}
${CXX} -o "$@" ${LDFLAGS} $^ ${CXX} $^ ${LDFLAGS} -o "$@"
endif endif
.PHONY: all clean .PHONY: all clean