Probleme mit Makefile



  • Also, ich hab hier ein Projekt das folgendermaßen aussieht

    /: Projekt-Root enthält Makefile
    /BasicFightSimulator: enthält Code-Dateien (.cpp, .hpp, .h)
    /Linux: darein sollen die Objekt-Dateien und das fertige Programm

    Mein Makefile sieht jetzt so aus:

    # Makefile for the basic fight simulator on Linux
    # created by Xenesis
    
    BUILD_DIR = ./Linux #in which directorie should i put the *.o and *.exe files
    SRC_DIR = ./BasicFightSimulator #where are the source files?
    BIN = $(BUILD_DIR)/basicfightsimulator.exe
    OBJ = $(BUILD_DIR)/%.o
    #compiler flags
    #CXXFLAGS +=
    
    .PHONY: build clean rebuild
    
    build: $(BIN)
    
    clean:
    	${RM} $(OBJ) $(BIN)
    
    rebuild: clean build
    
    $(BIN): $(OBJ)
    	$(CXX) $(OBJ) -o $(BIN)
    
    $(OBJ): $(SRC_DIR)/%.h $(SRC_DIR)/%.hpp $(SRC_DIR)/%.cpp
    	$(CXX) -c $(SRC_DIR)/%.cpp -o $(BUILD_DIR)/%.o $(CXXFLAGS)
    

    Leider funktioniert das nicht.
    Ich bekomme da die etwas seltsame Meldung:

    Makefile 24: Warnung: Die Befehle für das Ziel Linux werden überschrieben
    Makefile 21: Warnung: Alte Befehle für das Ziel Linux werden ignoriert
    make: Keine Regel vorhanden um das Target /%.h benötigt von Linux zu erstellen. Schluss.


Anmelden zum Antworten