-
-
Save hmyit/c1e2f0413cfd67d217b12cfd89e5efc1 to your computer and use it in GitHub Desktop.
Revisions
-
kanedo revised this gist
Apr 18, 2014 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -19,7 +19,10 @@ CFLAGS=-g -c # Linker Flags #-lz use with zlib for gzstream.o LDFLAGS=-g -lz # define an asset dir (optional) ASSETSDIR=assets # set to 1 if ASSETSDIR should be copied to BUILDIR # set to 0 if not WITH_COPY_ASSETS=1 # CONFIGURATION_BUILD_DIR is usually defined by Xcode @@ -31,9 +34,6 @@ else BUILDIR=build endif # list dependencies # DEPS=gzstream.c DEPS= -
kanedo revised this gist
Apr 18, 2014 . 1 changed file with 9 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -20,6 +20,8 @@ CFLAGS=-g -c #-lz use with zlib for gzstream.o LDFLAGS=-g -lz WITH_COPY_ASSETS=1 # CONFIGURATION_BUILD_DIR is usually defined by Xcode # use it. # otherwise (e.g. invoked from commandline) use build/ as buildir @@ -33,7 +35,8 @@ endif ASSETSDIR=assets # list dependencies # DEPS=gzstream.c DEPS= # replace .c file ending and replace it with .o. change dir to $(BUILDIR) DEPS_OBJECTS=$(patsubst %.c,$(BUILDIR)/%.o,$(DEPS)) @@ -57,8 +60,10 @@ all: $(BUILDIR)/$(EXECUTABLE) # PRODUCT_NAME is usually defined by xcode in which case only make all is invoked # to run the project. we need to copy some asset-files in the build folder in order to run the executable properly ifdef PRODUCT_NAME ifeq ($(WITH_COPY_ASSETS),1) $(MAKE) COPY_ASSETS endif endif # build executable $(BUILDIR)/$(EXECUTABLE): $(BUILDIR) $(DEPS_OBJECTS) $(OBJECTS) @@ -85,9 +90,11 @@ COPY_ASSETS: # copies optional asset files and # invokes the exec with arguments run: all ifeq ($(WITH_COPY_ASSETS),1) $(MAKE) COPY_ASSETS endif ./$(BUILDIR)/$(EXECUTABLE) -e $(BUILDIR)/$(ASSETSDIR)/e.train.gz -f $(BUILDIR)/$(ASSETSDIR)/f.train.gz -a $(BUILDIR)/$(ASSETSDIR)/Alignment.gz # remove generated files clean: rm -rf $(BUILDIR) $(DEPS_OBJECTS) $(OBJECTS) $(EXECUTABLE) -
kanedo revised this gist
Apr 18, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -51,7 +51,7 @@ else EXECUTABLE=singleWordExtract endif .PHONY: all run clean COPY_ASSETS all: $(BUILDIR)/$(EXECUTABLE) # PRODUCT_NAME is usually defined by xcode in which case only make all is invoked -
kanedo created this gist
Apr 18, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,93 @@ ############################################################# # # # Generic Makefile for C++ projects # # Author: Gabriel <[email protected]> # # Date: 2014-04-18 # # Version: 1.0 # # # ############################################################# # the C++ Compiler CPP=g++ # the C Compiler CC=gcc # Compiler flags for C++ CPPFLAGS=-g -c # Compiler flags for C CFLAGS=-g -c # Linker Flags #-lz use with zlib for gzstream.o LDFLAGS=-g -lz # CONFIGURATION_BUILD_DIR is usually defined by Xcode # use it. # otherwise (e.g. invoked from commandline) use build/ as buildir ifdef CONFIGURATION_BUILD_DIR BUILDIR=$(CONFIGURATION_BUILD_DIR) else BUILDIR=build endif # define an asset dir (optional) ASSETSDIR=assets # list dependencies DEPS=gzstream.c # replace .c file ending and replace it with .o. change dir to $(BUILDIR) DEPS_OBJECTS=$(patsubst %.c,$(BUILDIR)/%.o,$(DEPS)) # list sources SOURCES=$(wildcard *.cpp) # replace .cpp file ending and replace it with .o. change dir to $(BUILDIR) OBJECTS=$(patsubst %.cpp,$(BUILDIR)/%.o,$(SOURCES)) # PRODUCT_NAME is usually defined by Xcode. # use it as executable name # otherwise define your own ifdef PRODUCT_NAME EXECUTABLE=$(PRODUCT_NAME) else EXECUTABLE=singleWordExtract endif .PHONY all run clean COPY_ASSETS all: $(BUILDIR)/$(EXECUTABLE) # PRODUCT_NAME is usually defined by xcode in which case only make all is invoked # to run the project. we need to copy some asset-files in the build folder in order to run the executable properly ifdef PRODUCT_NAME $(MAKE) COPY_ASSETS endif # build executable $(BUILDIR)/$(EXECUTABLE): $(BUILDIR) $(DEPS_OBJECTS) $(OBJECTS) $(CPP) $(LDFLAGS) $(DEPS_OBJECTS) $(OBJECTS) -o $@ # compile dependencies $(DEPS_OBJECTS): $(DEPS) ${CPP} -I. -O -c $< -o $@ # compile cpp files $(BUILDIR)/%.o: %.cpp $(CPP) $(CPPFLAGS) $< -o $@ # target to create the builddir $(BUILDIR): mkdir -p $@ # phony target to copy asset files into the builddir COPY_ASSETS: mkdir -p $(BUILDIR)/$(ASSETSDIR) cp -rf $(ASSETSDIR)/ $(BUILDIR)/$(ASSETSDIR) # phony target which calls the executable # copies optional asset files and # invokes the exec with arguments run: all $(MAKE) COPY_ASSETS ./$(BUILDIR)/$(EXECUTABLE) -e $(BUILDIR)/$(ASSETSDIR)/e.train.gz -f $(BUILDIR)/$(ASSETSDIR)/f.train.gz -a $(BUILDIR)/$(ASSETSDIR)/Alignment.gz # remove generated files clean: rm -rf $(BUILDIR) $(DEPS_OBJECTS) $(OBJECTS) $(EXECUTABLE)