summaryrefslogtreecommitdiffstats
path: root/GNUmakefile
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-10 10:34:19 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-10 10:34:19 +0100
commit0a46c065bf0f9f97e8ad118dda9d6ca1c5e2f8eb (patch)
tree8075da8c1c754b6240cadcd0e18701df53c1aa0c /GNUmakefile
parentRemoved unused code (diff)
downloadcuberite-0a46c065bf0f9f97e8ad118dda9d6ca1c5e2f8eb.tar
cuberite-0a46c065bf0f9f97e8ad118dda9d6ca1c5e2f8eb.tar.gz
cuberite-0a46c065bf0f9f97e8ad118dda9d6ca1c5e2f8eb.tar.bz2
cuberite-0a46c065bf0f9f97e8ad118dda9d6ca1c5e2f8eb.tar.lz
cuberite-0a46c065bf0f9f97e8ad118dda9d6ca1c5e2f8eb.tar.xz
cuberite-0a46c065bf0f9f97e8ad118dda9d6ca1c5e2f8eb.tar.zst
cuberite-0a46c065bf0f9f97e8ad118dda9d6ca1c5e2f8eb.zip
Diffstat (limited to 'GNUmakefile')
-rw-r--r--GNUmakefile98
1 files changed, 98 insertions, 0 deletions
diff --git a/GNUmakefile b/GNUmakefile
new file mode 100644
index 000000000..7a66d0283
--- /dev/null
+++ b/GNUmakefile
@@ -0,0 +1,98 @@
+###################################################
+#
+# Makefile for MCServer
+# Creator ZFalt
+# Created: [Thu Feb 24 19:53:17 2011]
+#
+###################################################
+#
+# Info:
+# This makefile is gnu-make spacific, other make systems needn't understand it
+# This makefile generates include-file dependencies into *.d files in each build and then reuses these dependencies in the following builds
+#
+# Usage:
+# To make a release build, call "make release=1"
+# To make a debug build, call "make"
+#
+###################################################
+
+#
+# Macros
+#
+
+CC = /usr/bin/g++
+
+
+all: MCServer
+
+ifeq ($(release),1)
+CC_OPTIONS = -s -O3
+CCE_OPTIONS = -s -x c -O3
+LNK_OPTIONS = -lstdc++ -pthread -O3
+BUILDDIR = build/release/
+else
+CC_OPTIONS = -s -ggdb
+CCE_OPTIONS = -s -x c -ggdb
+LNK_OPTIONS = -lstdc++ -pthread -ggdb
+BUILDDIR = build/debug/
+endif
+
+
+#
+# INCLUDE directories for MCServer
+#
+
+INCLUDE = -I.\
+ -Isource\
+ -Isource/md5\
+ -IWebServer\
+ -Isource/packets\
+ -Itolua++-1.0.93/src/lib\
+ -Ilua-5.1.4/src\
+ -Izlib-1.2.5\
+ -IiniFile\
+ -Itolua++-1.0.93/include\
+ -Ijsoncpp-src-0.5.0/include\
+ -Ijsoncpp-src-0.5.0/src/lib_json
+
+#
+# Build MCServer
+#
+
+SOURCES := $(shell find lua-5.1.4 jsoncpp-src-0.5.0 zlib-1.2.5 source tolua++-1.0.93 iniFile WebServer '(' -name '*.cpp' -o -name '*.c' ')')
+SOURCES := $(filter-out %minigzip.c %lua.c %tolua.c %toluabind.c %example.c,$(SOURCES))
+OBJECTS := $(patsubst %.c,$(BUILDDIR)%.o,$(SOURCES))
+OBJECTS := $(patsubst %.cpp,$(BUILDDIR)%.o,$(OBJECTS))
+
+-include $(OBJECTS:.o=.d)
+
+MCServer : $(OBJECTS)
+ $(CC) $(LNK_OPTIONS) $(OBJECTS) -o MCServer
+
+clean :
+ rm -rf $(BUILDDIR) MCServer
+
+install : MCServer
+ cp MCServer MCServer
+
+#
+# Build the parts of MCServer
+#
+
+$(BUILDDIR)%.o: %.c
+ @mkdir -p $(dir $@)
+ $(CC) $(CCE_OPTIONS) -c $(INCLUDE) $< -o $@
+ @$(CC) $(CC_OPTIONS) -MM $(INCLUDE) $< > $(patsubst %.o,%.d,$@)
+ @mv -f $(patsubst %.o,%.d,$@) $(patsubst %.o,%.d,$@).tmp
+ @sed -e 's|.*:|$*.o:|' < $(patsubst %.o,%.d,$@).tmp > $(patsubst %.o,%.d,$@)
+ @sed -e 's/.*://' -e 's/\\$$//' < $(patsubst %.o,%.d,$@).tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $(patsubst %.o,%.d,$@)
+ @rm -f $(patsubst %.o,%.d,$@).tmp
+
+$(BUILDDIR)%.o: %.cpp
+ @mkdir -p $(dir $@)
+ $(CC) $(CC_OPTIONS) -c $(INCLUDE) $< -o $@
+ @$(CC) $(CC_OPTIONS) -MM $(INCLUDE) $< > $(patsubst %.o,%.d,$@)
+ @mv -f $(patsubst %.o,%.d,$@) $(patsubst %.o,%.d,$@).tmp
+ @sed -e 's|.*:|$*.o:|' < $(patsubst %.o,%.d,$@).tmp > $(patsubst %.o,%.d,$@)
+ @sed -e 's/.*://' -e 's/\\$$//' < $(patsubst %.o,%.d,$@).tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $(patsubst %.o,%.d,$@)
+ @rm -f $(patsubst %.o,%.d,$@).tmp