Skip to content

Instantly share code, notes, and snippets.

@lo48576
Created October 31, 2012 13:27
Show Gist options
  • Save lo48576/3987041 to your computer and use it in GitHub Desktop.
Save lo48576/3987041 to your computer and use it in GitHub Desktop.
開発に使いそうなファイルのテンプレート
# for gnumake
# (
TARGET_DRV = $(OUTDIR)/sxheme
TARGET_LIB = $(OUTDIR)/sxheme.a
#EXTS := extlib
# c++ source files
CPPSRCNAMES = stringid.cpp largearray.cpp unicode.cpp parser_r6rs.cpp object_types.cpp object.cpp object_data.cpp object_func.cpp environment.cpp procedure.cpp
# c++ source files for testing program
CPPDRVNAMES = main.cpp
MEDIA =
DEBUG = 1
# don't edit after here.
CPPSRCS = $(CPPSRCNAMES:%=source/%)
CPPDRVS = $(CPPDRVNAMES:%=source/%)
CPPOBJS = $(CPPSRCNAMES:%.cpp=$(INTDIR)/%.o)
CPPDRVOBJS = $(CPPDRVNAMES:%.cpp=$(INTDIR)/%.o)
#EXTOBJNAMES = sfmt.o
EXTOBJS = $(EXTOBJNAMES:%.o=$(INTDIR)/%.o)
ifdef DEBUG
DEBUG_FLAG := -DDEBUG
INTDIR := obj/Debug
OUTDIR := test
TARGETS = $(TARGET_DRV)
else
DEBUG_FLAG :=
INTDIR := obj/Release
OUTDIR := bin
TARGETS = $(TARGET_DRV) $(TARGET_LIB)
endif
CPPDEPENDS = $(INTDIR)/.depend_cpp~
DEPENDS = $(CPPDEPENDS)
LDFLAGS := -lm -lpthread
CXXFLAGS_ := -Wall --std=c++11
INCLUDES := -Iinc
MACRODEF :=
#CXX with Flags
#CXXF = $(CXX) $(INCLUDES) $(CXXFLAGS) $(LDFLAGS) $(MACRODEF) $(DEBUG_FLAG)
CXXFLAGS := $(INCLUDES) $(CXXFLAGS_) $(LDFLAGS) $(MACRODEF) $(DEBUG_FLAG)
CXXF = $(CXX) $(CXXFLAGS)
.PHONY: all clean depend
TARGET: $(TARGETS) depend
clean:
-rm $(INTDIR)/* $(TARGET_DRV) $(TARGET_LIB)
-rm $(DEPENDS)
depend: $(DEPENDS) makefile
${CPPDEPENDS}: $(CPPSRCS)
@echo "$(CPPDEPENDS) generated."
@-mkdir -p $(INTDIR)
@:>$@
@set -e; $(CXXF) -MM $(CPPSRCS) | sed -e ':contline; /\\ *$$/ {N;b contline};s@\([^:]*\):@$(INTDIR)/\1\ :@g;/[^:]*:/a \\t$$(CXXF) -c $$< -o $$@\n\t@echo " "`date`' >$@
.cpp.o:
$(CXXF) $<
all: depend $(TARGET) $(EXTS)
${EXTS}: extlib/makefile
$(MAKE) -C $@
-cp $(shell find $(EXTS) -maxdepth 1 -name '*.o') $(INTDIR)/ 2>/dev/null
${TARGET_LIB}: $(CPPOBJS) $(MEDIA)
# @echo "Sorry! I don't know how to make library!"
${TARGET_DRV}: $(CPPOBJS) $(MEDIA)
$(CXXF) -o $@ $^
echo ' @echo " "`date`'
-include $(DEPENDS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment