summaryrefslogtreecommitdiff
path: root/src/common/Makefile.in
blob: 37606dde23df23441f6e98e364f8d0f40c3a5354 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
COMMON_OBJ = obj_all/core.o obj_all/socket.o obj_all/timer.o obj_all/db.o obj_all/plugins.o obj_all/lock.o \
	obj_all/nullpo.o obj_all/malloc.o obj_all/showmsg.o obj_all/strlib.o obj_all/utils.o \
	obj_all/grfio.o obj_all/mapindex.o obj_all/ers.o obj_all/md5calc.o \
	obj_all/minicore.o obj_all/minisocket.o obj_all/minimalloc.o obj_all/random.o
COMMON_H = svnversion.h mmo.h plugin.h version.h \
	core.h socket.h timer.h db.h plugins.h lock.h \
	nullpo.h malloc.h showmsg.h  strlib.h utils.h \
	grfio.h mapindex.h ers.h md5calc.h random.h

COMMON_SQL_OBJ = obj_sql/sql.o
COMMON_SQL_H = sql.h

MT19937AR_OBJ = ../../3rdparty/mt19937ar/mt19937ar.o
MT19937AR_H = ../../3rdparty/mt19937ar/mt19937ar.h
MT19937AR_INCLUDE = -I../../3rdparty/mt19937ar

HAVE_MYSQL=@HAVE_MYSQL@
ifeq ($(HAVE_MYSQL),yes)
	ALL_DEPENDS=txt sql
	SQL_DEPENDS=common common_sql
else
	ALL_TARGET=txt
	SQL_DEPENDS=needs_mysql
endif
TXT_DEPENDS=common

@SET_MAKE@

#####################################################################
.PHONY : all txt sql clean help

all: $(ALL_DEPENDS)

txt: $(TXT_DEPENDS)

sql: $(SQL_DEPENDS)

clean:
	rm -rf *.o obj_all obj_sql svnversion.h

help:
	@echo "possible targets are 'txt' 'sql' 'all' 'clean' 'help'"
	@echo "'txt'    - builds object files used in txt servers"
	@echo "'sql'    - builds object files used in sql servers"
	@echo "'all'    - builds all above targets"
	@echo "'clean'  - cleans builds and objects"
	@echo "'help'   - outputs this message"

#####################################################################

needs_mysql:
	@echo "MySQL not found or disabled by the configure script"
	@exit 1

obj_all:
	-mkdir obj_all

obj_sql:
	-mkdir obj_sql

common: obj_all $(COMMON_OBJ) $(MT19937AR_OBJ)

common_sql: obj_sql $(COMMON_SQL_OBJ)


obj_all/%.o: %.c $(COMMON_H) $(MT19937AR_H)
	@CC@ @CFLAGS@ $(MT19937AR_INCLUDE) @LDFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<

obj_all/mini%.o: %.c $(COMMON_H) $(MT19937AR_H)
	@CC@ @CFLAGS@ $(MT19937AR_INCLUDE) -DMINICORE @LDFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<

obj_sql/%.o: %.c $(COMMON_H) $(COMMON_SQL_H)
	@CC@ @CFLAGS@ @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<


HAVESVN = $(shell which svnversion)

ifeq ($(findstring /,$(HAVESVN)), /)
svnversion.h:
	@printf "#define SVNVERSION " > svnversion.h
	@svnversion .. >> svnversion.h
	@printf "\n" >> svnversion.h
else
svnversion.h:
	@printf "\n" > svnversion.h
endif

# missing object files
MT19937AR_OBJ:
	@$(MAKE) -C ../../3rdparty/mt19937ar