Skip to content

Instantly share code, notes, and snippets.

@adurpas
Created December 3, 2012 14:56
Show Gist options
  • Save adurpas/4195477 to your computer and use it in GitHub Desktop.
Save adurpas/4195477 to your computer and use it in GitHub Desktop.
# Quick and very dirty!
BASEPATH=~/Documents/Lab8/Ex1
# Which target? set default
ifndef TARGET
TARGET=host
#TARGET=target
endif
# Debug build? debug is default
ifdef DEBUG
CXXFLAGS=-g
DEST_DIR=lib/${TARGET}/debug
else
CXXFLAGS=-O2
DEST_DIR=lib/${TARGET}/release
endif
OBJ_DEST_DIR=build/${DEST_DIR}
COMMON=$(addprefix common/,Time.cpp Timer.cpp LogSystem.cpp LogOutputStdOut.cpp LogTypes.cpp Log.cpp Completion.cpp)
LINUX=$(addprefix linux/,ClockTime.cpp Mutex.cpp Conditional.cpp Thread.cpp ThreadFunctor.cpp Semaphore.cpp Utility.cpp)
SRC=${COMMON} ${LINUX}
OBJS=$(addprefix ${OBJ_DEST_DIR}/,$(notdir ${SRC:%.cpp=%.o}))
ifeq (${TARGET},host)
# Include host specific stuff
include ~/Documents/Lab8/Ex1/compiler_setup.host
endif
ifeq (${TARGET},target)
# Include target specific stuff
include ~/Documents/Lab8/Ex1/compiler_setup.target
endif
# Setting compiler flags
CXXFLAGS+= -Wall -Iinc -D${OS}
${OBJ_DEST_DIR}/%.o: common/%.cpp
@echo "Compiling "$<
@${CXX} -c $< -o $@ ${CXXFLAGS}
${OBJ_DEST_DIR}/%.o: linux/%.cpp
@echo "Compiling "$<
@${CXX} -c $< -o $@ ${CXXFLAGS}
${DEST_DIR}:
mkdir -p ${DEST_DIR}
${OBJ_DEST_DIR}:
mkdir -p ${OBJ_DEST_DIR}
${DEST_DIR}/libOSApi.a: ${OBJ_DEST_DIR} ${DEST_DIR} ${OBJS}
${AR} cq $@ ${OBJS}
all: ${DEST_DIR}/libOSApi.a
clean:
rm -f ${DEST_DIR}/libOSApi.a ${OBJS}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment