summaryrefslogtreecommitdiff
path: root/src/master/Makefile
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-03-22 17:56:34 +0100
committerPaweł Redman <pawel.redman@gmail.com>2017-03-22 17:56:34 +0100
commit6a777afc079c2a8d3af3ecd2145fe8dd50567a39 (patch)
tree520f4489cebf8564ef6cb27064ceea45cbc005b3 /src/master/Makefile
Funko sources as released by Rotacak.HEADmaster
Diffstat (limited to 'src/master/Makefile')
-rw-r--r--src/master/Makefile51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/master/Makefile b/src/master/Makefile
new file mode 100644
index 0000000..2f60b41
--- /dev/null
+++ b/src/master/Makefile
@@ -0,0 +1,51 @@
+BD_DEBUG=debug-$(PLATFORM)-$(ARCH)
+BD_RELEASE=release-$(PLATFORM)-$(ARCH)
+
+ifeq ($(PLATFORM),mingw32)
+ BINEXT=.exe
+ RELEASE_LDFLAGS=-lwsock32
+ DEBUG_LDFLAGS=-lwsock32
+ RM=rm -f
+ MKDIR=mkdir
+else
+ BINEXT=
+ RELEASE_LDFLAGS=-ltdb
+ DEBUG_LDFLAGS=-ltdb
+ RM=rm -f
+ MKDIR=mkdir
+endif
+
+CC=gcc
+RELEASE_CFLAGS=-Wall -O2
+DEBUG_CFLAGS=-g
+OBJECTS= \
+ $(BD)/master.o \
+ $(BD)/messages.o \
+ $(BD)/stats.o \
+ $(BD)/servers.o
+
+release: makedirs
+ $(MAKE) $(BD_RELEASE)/tremmaster BD=$(BD_RELEASE) \
+ CFLAGS="$(CFLAGS) $(RELEASE_CFLAGS)" LDFLAGS="$(LDFLAGS) $(RELEASE_LDFLAGS)"
+
+debug: makedirs
+ $(MAKE) $(BD_DEBUG)/tremmaster BD=$(BD_DEBUG) \
+ CFLAGS="$(CFLAGS) $(DEBUG_CFLAGS)" LDFLAGS="$(LDFLAGS) $(DEBUG_LDFLAGS)"
+
+all: release debug
+
+$(BD)/%.o: %.c
+ $(CC) $(CFLAGS) -o $@ -c $<
+
+$(BD)/tremmaster: $(OBJECTS)
+ $(CC) -o $@ $(OBJECTS) $(LDFLAGS)
+
+clean:
+ -$(RM) $(BD_DEBUG)/*
+ -$(RM) $(BD_RELEASE)/*
+
+makedirs:
+ @if [ ! -d $(BD_RELEASE) ];then $(MKDIR) $(BD_RELEASE);fi
+ @if [ ! -d $(BD_DEBUG) ];then $(MKDIR) $(BD_DEBUG);fi
+
+.PHONY: all clean release debug makedirs