Created
November 22, 2011 02:33
-
-
Save BourneID/1384722 to your computer and use it in GitHub Desktop.
Project Makefile Template
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
# | |
# Project Makefile Template | |
# | |
INC = . | |
SRC = . | |
OUT = . | |
OBJ = obj | |
JSON_CPP_INC = ../jsoncpp/include | |
JSON_CPP_LIB = ../jsoncpp/libs | |
# | |
# g++ relative flags | |
# | |
GCC = g++ | |
COMPILE = -c -g -D_GNE_SOURCE -fPIC -Wall | |
# static for link .a lib, not the default .so one | |
LINK = -Wall -fPIC -g -pthread -lpthread -lrt -L"$(JSON_CPP_LIB)" -static -ljson | |
ADD_INCS = -I"$(INC)" \ | |
-I"$(JSON_CPP_INC)" \ | |
# | |
# target(s) | |
# | |
TARGET = $(OUT)/json_demo | |
OBJECTS = $(OBJ)/json_hw.o \ | |
ALL = MK_DIR $(TARGET) | |
# | |
# make all | |
# | |
all : $(ALL) | |
$(TARGET) : $(OBJECTS) $(JSON_CPP_LIB)/libjson.a | |
$(GCC) $(LINK) $^ -o $@ | |
$(OBJ)/json_hw.o : $(SRC)/json_hw.cpp | |
$(GCC) $(COMPILE) $(ADD_INCS) $^ -o $@ | |
# | |
# other commands | |
# | |
.PHONY: clean MK_DIR | |
clean: | |
rm -rf $(OBJ) $(TARGET) | |
MK_DIR: | |
mkdir -p $(OBJ) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment