I am attempting to use Makefile for the first time. Is it possible to compile 2 different c++ programs into 2 executables using one Makefile?
Here is what I've done so far but it will only compile the first one.
CFLAGS=-O3 -Wall
series : ./problem1/series.cpp
g++ $(CFLAGS) -o series ./problem1/series.cpp
gn : ./problem1/gn.cpp
g++ $(CFLAGS) -o gn ./problem1/gn.cpp
EDIT:
How can I stop it from compiling every time (unless I modify the code)?
CFLAGS=-O3 -Wall
all : q1_series q1_gn q1_series_new_initial
q1_series : ./problem1/series.cpp
g++ $(CFLAGS) -o ./executables/q1_series ./problem1/series.cpp
q1_gn : ./problem1/gn.cpp
g++ $(CFLAGS) -o ./executables/q1_gn ./problem1/gn.cpp
q1_series_new_initial : ./problem1/series1.cpp
g++ $(CFLAGS) -o ./executables/q1_series_new_initial ./problem1/series1.cpp
echo "Question 1 created in ./executables"