Last active
August 29, 2015 14:09
-
-
Save Dekker1/02787fd9af5f8027992a to your computer and use it in GitHub Desktop.
Gecode Makefile OSX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A simple and basic Makefile build script for Gecode for Mac OSX. | |
# | |
# Author: | |
# Jip J. Dekker <jip@dekker.li> | |
# Based on similar makefile for linux by Georgios Petrousis <gpetrousis@gmail.com> | |
# | |
# Updated on: 9/11/2014 | |
# | |
# Feel free to distribute this file to anyone. | |
# Please contact me for any corrections and suggestions. | |
# | |
# Instructions: | |
# Add this file to the top level directory of your project. | |
# Uncomment the libraries you need and change the path of | |
# Gecode libraries according to your needs. | |
# This make file finds all the .cpp files in the folder | |
# and produces an executable for each one. | |
# | |
# Run the following command: | |
# make To compile the program. | |
# make clean Remove all files created by make. | |
# Define the compiler | |
CXX=clang++ | |
# Define the source files. | |
SOURCES=$(wildcard *.cpp) | |
# Define the object files | |
OBJECTS=$(SOURCES:.cpp=.o) | |
# Define the name of the executables | |
EXECUTABLES=$(SOURCES:.cpp=) | |
# Set the compiler options | |
# -O3 Optimisation level | |
# -g To compile with debugging flags, for use with gdb. | |
# -Wall Enable all warnings | |
# -std=c++11 Use C++11 standard | |
# -stdlib=libstdc++ Use the right standard library | |
# -F/Library/Frameworks Standard installation directory for the gecode framework | |
CFLAGS=-O3 -g -Wall -F/Library/Frameworks | |
CXXFLAGS=$(CFLAGS) -std=c++11 -stdlib=libstdc++ -framework gecode | |
# The make command will do both compile and link | |
all: $(EXECUTABLES) | |
# Compile the source files into .o object files | |
%.o: %.cpp | |
$(CXX) $(CXXFLAGS) -c $< | |
# Link object files to Gecode libraries and create the executable file | |
$(EXECUTABLE): $(OBJECTS) | |
$(CXX) $(CXXFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LDFLAGS) | |
clean: | |
rm -rf *.dSYM *.o $(EXECUTABLES) | |
.PHONY: all clean |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment