Skip to content

Instantly share code, notes, and snippets.

@joshkalpin
Created November 22, 2014 19:21
Show Gist options
  • Save joshkalpin/d5691a40d6bb69611eb6 to your computer and use it in GitHub Desktop.
Save joshkalpin/d5691a40d6bb69611eb6 to your computer and use it in GitHub Desktop.
Generic Makefile
CXX = g++
# variables and initialization
CXXFLAGS = -g -Wall -MMD `pkg-config gtkmm-2.4 --cflags --libs`
# builds dependency lists in .d files
OBJECTS = Views/StraightsWindow.o Views/DeckUI.o main.o Views/PlayerFrame.o Views/MessageDialogBox.o Views/ConfigurationDialogBox.o Model/GameMaster.o Model/Player.o Controller/StraightsController.o Common/Card.o Model/Deck.o Model/Table.o Model/Subject.o Model/HumanPlayer.o Model/SmartComputerPlayer.o Model/ComputerPlayer.o
DEPENDS = ${OBJECTS:.o=.d}
# substitute ".o" with ".d"
EXEC = straights
${EXEC} : ${OBJECTS}
${CXX} ${OBJECTS} ${CXXFLAGS} -o ${EXEC}
clean : # separate target; cleans directory
rm -rf ${DEPENDS} ${OBJECTS} ${EXEC}
-include ${DEPENDS}
# reads the .d files and reruns
# dependencies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment