Let's say I have two C++ main files, project.cpp
, and projectgraph.cpp
. They both use the same header file functions.h
, as well as the file functions.cpp
.
To compile project.cpp
, I'm using the following makefile :
CXX = g++
CXXFLAGS= -std=c++11 -w -Wall -g
project: project.o functions.o
$(CXX) $(CXXFLAGS) -o project projet.o functions.o
functions.o: functions.h
clean:
rm -rf *.o
I would like to be able to choose between project.cpp
and projectgraph.cpp
to be compiled using the make
command in the terminal. For example :
- If I type
make
in the terminal :project.cpp
would be compiled. - If I type
make graph
in the terminal :projectgraph.cpp
would be compiled.
How can I change the makefile to get this result ?
Thanks !
Aucun commentaire:
Enregistrer un commentaire