Ich bin neu bei makefiles und habe einige Probleme damit. Ich habe das folgende Makefile erstellt. Es funktioniert korrekt. Aber wenn ich die main.cpp und laufen machen. heißt es "Alles ist auf dem neuesten Stand" . Ich muss eine sauber machen und make erneut ausführen, wird alles funktionieren.
Es sieht so aus, als gäbe es ein Problem mit diesem Makefile, und ich kann nicht herausfinden, wo der Fehler liegt. Kann mir jemand helfen, herauszufinden, wo der Fehler in diesem Makefile liegt und warum es keine geänderten Dateien erstellt?
#Main makefile which does the build
CFLAGS =
CC = g++
PROG = fooexe
#each module will append the source files to here
SRC :=
#including the description
include foo/module.mk
OBJ := $(patsubst %.cpp, %.o, $(filter %.cpp,$(SRC))) main.o
#linking the program
fooexe: $(OBJ)
$(CC) -o $(PROG) $(OBJ)
%.o:
$(CC) -c $(SRC) -o $(patsubst %.cpp, %.o, $(filter %.cpp,$(SRC)))
main.o:
$(CC) -c main.cpp
depend:
makedepend -- $(CFLAGS) -- $(SRC)
.PHONY:clean
clean:
find . -name "*.o" | xargs rm -vf
rm -vf fooexe