aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2010-12-19 19:11:05 +0200
committerPerttu Ahola <celeron55@gmail.com>2010-12-19 19:11:05 +0200
commitab7477c4c3e2a3647dc4fb65c71567946d33b0e3 (patch)
treefb9aaca70617875ff68f8ba1674f5a6fccd4f385 /Makefile
parent0ca9423b8b2cf7bd1435fb09eba7a9f50d444864 (diff)
downloadminetest-ab7477c4c3e2a3647dc4fb65c71567946d33b0e3.tar.gz
minetest-ab7477c4c3e2a3647dc4fb65c71567946d33b0e3.tar.bz2
minetest-ab7477c4c3e2a3647dc4fb65c71567946d33b0e3.zip
added dedicated server build without irrlicht
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile65
1 files changed, 43 insertions, 22 deletions
diff --git a/Makefile b/Makefile
index dfe180573..08107718c 100644
--- a/Makefile
+++ b/Makefile
@@ -4,25 +4,28 @@
TARGET = test
SOURCE_FILES = guiPauseMenu.cpp mapnode.cpp tile.cpp voxel.cpp mapblockobject.cpp inventory.cpp debug.cpp serialization.cpp light.cpp filesys.cpp connection.cpp environment.cpp client.cpp server.cpp socket.cpp mapblock.cpp mapsector.cpp heightmap.cpp map.cpp player.cpp utility.cpp main.cpp test.cpp
SOURCES = $(addprefix src/, $(SOURCE_FILES))
-OBJECTS = $(SOURCES:.cpp=.o)
-FASTTARGET = fasttest
+BUILD_DIR = build
+OBJECTS = $(addprefix $(BUILD_DIR)/, $(SOURCE_FILES:.cpp=.o))
+#OBJECTS = $(SOURCES:.cpp=.o)
+
+FAST_TARGET = fasttest
+
+SERVER_TARGET = server
+SERVER_SOURCE_FILES = mapnode.cpp voxel.cpp mapblockobject.cpp inventory.cpp debug.cpp serialization.cpp light.cpp filesys.cpp connection.cpp environment.cpp server.cpp socket.cpp mapblock.cpp mapsector.cpp heightmap.cpp map.cpp player.cpp utility.cpp servermain.cpp test.cpp
+SERVER_SOURCES = $(addprefix src/, $(SERVER_SOURCE_FILES))
+SERVER_BUILD_DIR = serverbuild
+SERVER_OBJECTS = $(addprefix $(SERVER_BUILD_DIR)/, $(SERVER_SOURCE_FILES:.cpp=.o))
+#SERVER_OBJECTS = $(SERVER_SOURCES:.cpp=.o)
IRRLICHTPATH = ../irrlicht/irrlicht-1.7.1
JTHREADPATH = ../jthread/jthread-1.2.1
-CPPFLAGS = -I$(IRRLICHTPATH)/include -I/usr/X11R6/include -I$(JTHREADPATH)/src
-
#CXXFLAGS = -O2 -ffast-math -Wall -fomit-frame-pointer -pipe
CXXFLAGS = -O2 -ffast-math -Wall -g -pipe
#CXXFLAGS = -O1 -ffast-math -Wall -g
#CXXFLAGS = -Wall -g -O0
-#CXXFLAGS = -O3 -ffast-math -Wall
-#CXXFLAGS = -O3 -ffast-math -Wall -g
-#CXXFLAGS = -O2 -ffast-math -Wall -g
-
-FASTCXXFLAGS = -O3 -ffast-math -Wall -fomit-frame-pointer -pipe -funroll-loops -mtune=i686
-#FASTCXXFLAGS = -O3 -ffast-math -Wall -fomit-frame-pointer -pipe -funroll-loops -mtune=i686 -fwhole-program
+#FAST_CXXFLAGS = -O3 -ffast-math -Wall -fomit-frame-pointer -pipe -funroll-loops -mtune=i686
#Default target
@@ -35,8 +38,13 @@ endif
# Target specific settings
all_linux fast_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L$(IRRLICHTPATH)/lib/Linux -L$(JTHREADPATH)/src/.libs -lIrrlicht -lGL -lXxf86vm -lXext -lX11 -ljthread -lz
+all_linux fast_linux: CPPFLAGS = -I$(IRRLICHTPATH)/include -I/usr/X11R6/include -I$(JTHREADPATH)/src
+fast_linux server_linux: CXXFLAGS = -O3 -ffast-math -Wall -fomit-frame-pointer -pipe -funroll-loops -mtune=i686
+server_linux: LDFLAGS = -L$(JTHREADPATH)/src/.libs -ljthread -lz -lpthread
+server_linux: CPPFLAGS = -I$(IRRLICHTPATH)/include -I/usr/X11R6/include -I$(JTHREADPATH)/src -DSERVER
all_linux fast_linux clean_linux: SYSTEM=Linux
+# These are out of date
all_win32: LDFLAGS = -L$(IRRLICHTPATH)/lib/Win32-gcc -L$(JTHREADPATH)/Debug -lIrrlicht -lopengl32 -lm -ljthread
all_win32 clean_win32: SYSTEM=Win32-gcc
all_win32 clean_win32: SUF=.exe
@@ -44,31 +52,44 @@ all_win32 clean_win32: SUF=.exe
# Name of the binary - only valid for targets which set SYSTEM
DESTPATH = bin/$(TARGET)$(SUF)
-FASTDESTPATH = bin/$(FASTTARGET)$(SUF)
+FAST_DESTPATH = bin/$(FAST_TARGET)$(SUF)
+SERVER_DESTPATH = bin/$(SERVER_TARGET)$(SUF)
# Build commands
-all_linux all_win32: $(DESTPATH)
-
-fast_linux: $(FASTDESTPATH)
+all_linux all_win32: make_build_dir $(DESTPATH)
+fast_linux: make_build_dir $(FAST_DESTPATH)
+server_linux: make_server_build_dir $(SERVER_DESTPATH)
-$(FASTDESTPATH): $(SOURCES)
- $(CXX) -o $(FASTDESTPATH) $(SOURCES) $(CPPFLAGS) $(FASTCXXFLAGS) $(LDFLAGS) -DUNITTEST_DISABLE
- @# Errno doesn't work ("error: ‘__errno_location’ was not declared in this scope")
- @#cat $(SOURCES) | $(CXX) -o $(FASTDESTPATH) -x c++ - -Isrc/ $(CPPFLAGS) $(FASTCXXFLAGS) $(LDFLAGS) -DUNITTEST_DISABLE -DDISABLE_ERRNO
+make_build_dir:
+ mkdir -p $(BUILD_DIR)
+make_server_build_dir:
+ mkdir -p $(SERVER_BUILD_DIR)
$(DESTPATH): $(OBJECTS)
$(CXX) -o $@ $(OBJECTS) $(LDFLAGS)
-.cpp.o:
+$(FAST_DESTPATH): $(SOURCES)
+ $(CXX) -o $@ $(OBJECTS) $(LDFLAGS) -DUNITTEST_DISABLE
+
+$(SERVER_DESTPATH): $(SERVER_OBJECTS)
+ $(CXX) -o $@ $(SERVER_OBJECTS) $(LDFLAGS) -DSERVER -DUNITTEST_DISABLE
+
+$(BUILD_DIR)/%.o: src/%.cpp
$(CXX) -c -o $@ $< $(CPPFLAGS) $(CXXFLAGS)
-clean: clean_linux clean_win32 clean_fast_linux
+$(SERVER_BUILD_DIR)/%.o: src/%.cpp
+ $(CXX) -c -o $@ $< $(CPPFLAGS) $(CXXFLAGS)
+
+clean: clean_linux clean_win32 clean_fast_linux clean_server_linux
clean_linux clean_win32:
@$(RM) $(OBJECTS) $(DESTPATH)
clean_fast_linux:
- @$(RM) $(FASTDESTPATH)
+ @$(RM) $(OBJECTS) $(FAST_DESTPATH)
+
+clean_server_linux:
+ @$(RM) $(SERVER_OBJECTS) $(SERVER_DESTPATH)
-.PHONY: all all_win32 clean clean_linux clean_win32
+.PHONY: all all_win32 clean clean_linux clean_win32 clean_fast_linux clean_server_linux