Reputation: 14132
I have some code that everytime I want to compile I have to do the following command in the linux shell (just an example):
$g++ -I. -I$SYSTEMC_HOME/include -L. -L$SYSTEMC_HOME/lib-linux64 -o sim helloworld.cpp -lsystemc -lm
In this example my source file is helloworld.cpp
and I want it to be compiled in a folder called sim
in the same folder where the source file is.
How can I automate this process using make
or makefile
. Also having the make clean
option to remove the created folder if called?
Upvotes: 0
Views: 543
Reputation: 21040
If you rename your cpp file to sim.cpp
this is probably the simplest Makefile
CPPFLAGS := -I. -I$(SYSTEMC_HOME)/include
LDFLAGS := -L. -L$(SYSTEMC_HOME)/lib-linux64
LDLIBS := -lsystemc -lm
sim:
.PHONY: clean
clean: ; $(RM) sim
The implicit rules should handle everything else for you
Upvotes: 1