The following is a basic makefile that worked for me. However, there’s a link at the bottom to a forum post that provides a better solution.
#The c++ compiler you'd like to use: CC=g++ #the following is for normal use: CFLAGS=-c -O3 -Wall LDFLAGS= #the following is for using gprof or valgrind (only comment out one at a time) #CFLAGS=-g -pg -c -O3 -Wall #LDFLAGS=-pg #All your .cpp files go below. This simple example assumes they're all in the same directory: SOURCES=calculations.cpp Dates.cpp Demands.cpp triangleSimulation.cpp OBJECTS=$(SOURCES:.cpp=.o) #Below you place your target name, what you want the program to be called. EXECUTABLE=triangleSimulation all: $(SOURCES) $(EXECUTABLE) $(EXECUTABLE): $(OBJECTS) $(CC) $(LDFLAGS) $(OBJECTS) -o $@ .cpp.o: $(CC) $(CFLAGS) $^ -o $@ clean: rm -rf *.o $(EXECUTABLE)
Pingback: Compiling OpenSees on the Janus cluster | Water Programming: A Collaborative Research Blog
Pingback: How to set up MinGW for the first time | Water Programming: A Collaborative Research Blog
Pingback: Compiling, running, and linking a simulation model to Borg: LRGV Example | Water Programming: A Collaborative Research Blog
Pingback: Water Programming Blog Guide (Part I) – Water Programming: A Collaborative Research Blog