https://doi.org/10.5201/ipol.2015.108
Makefile
# C++ source code
CXXSRC = flutter_optimiser_uniform.cpp \
flutter_optimiser_gaussian.cpp \
gain_evaluation.cpp\
optimal_snapshot.cpp\
demo_fluttercode.cpp
# all source code
SRC = $(CSRC) $(CXXSRC)
# C objects
COBJ = $(CSRC:.c=.o)
# C++ objects
CXXOBJ = $(CXXSRC:.cpp=.o)
# all objects
OBJ = $(COBJ) $(CXXOBJ)
# binary target
BIN = flutter_optimizer
default : $(BIN)
# C optimization flags
COPT = -O3 -ftree-vectorize -funroll-loops
# C++ optimization flags
CXXOPT = $(COPT)
# C compilation flags
CFLAGS = $(COPT) -Wall -Wextra \
-Wno-write-strings -ansi
# C++ compilation flags
CXXFLAGS = $(CXXOPT) -Wall -Wextra \
-Wno-write-strings -Wno-deprecated -ansi
# link flags
LDFLAGS = -lm
# use DEBUG
ifdef DEBUG
CFLAGS += -g
CXXFLAGS += -g
LDFLAGS += -g
endif
# partial compilation of C source code
%.o: %.c %.h
$(CC) -c -o $@ $< $(CFLAGS)
# partial compilation of C++ source code
%.o: %.cpp %.h
$(CXX) -c -o $@ $< $(CXXFLAGS)
# link all the opject code
$(BIN): $(OBJ) $(LIBDEPS)
$(CXX) -o $@ $(OBJ) $(LDFLAGS)
# housekeeping
.PHONY : clean distclean
clean :
$(RM) $(OBJ)
distclean : clean
$(RM) $(BIN)