Skip to content

Instantly share code, notes, and snippets.

@adurpas
Created December 3, 2012 14:56
Show Gist options
  • Save adurpas/4195478 to your computer and use it in GitHub Desktop.
Save adurpas/4195478 to your computer and use it in GitHub Desktop.
example/Makefile
SRCS=main.cpp KeyBoardInput.cpp LogSystem.cpp
OBJS=$(SRCS:.cpp=.o)
#BASEPATH=..
BASEPATH=~/Documents/Lab8/Ex1
ifeq (${TARGET},host)
# We need to include host specific things
#include ../compiler_setup.host
include ~/Documents/Lab8/Ex1/compiler_setup.host
endif
ifeq (${TARGET},target)
# We need to include target specific things
#include ../compiler_setup.target
include ~/Documents/Lab8/Ex1/compiler_setup.target
endif
#Determine whether this is a debug build or not
ifdef DEBUG
CXXFLAGS=-ggdb -O0
LIBPATH=$(BASEPATH)/lib/$(TARGET)/debug
#LIBPATH=$(BASEPATH)/lib/host/debug
else
CXXFLAGS=-O2
LIBPATH=$(BASEPATH)/lib/$(TARGET)/release
#LIBPATH=$(BASEPATH)/lib/host/release
endif
# Setup the CFLAGS to ensure that the relevant warnings, includes and defines.
CXXFLAGS+=-Wall -D_REENTRANT -DOS_LINUX -I $(BASEPATH)/inc
#%.o: %cpp
# g++ $CXXFLAGS) -c -o $@ $^
# The again, note how the flags are NOT part of the linking process.
main:$(OBJS)
$(CXX) -o main $(OBJS) -L $(LIBPATH) -lOSApi -lrt -lpthread
all: main
clean:$(OBJS)
rm -f *.o main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment