1 | @SET_MAKE@ |
---|
2 | |
---|
3 | HAVE_MYSQL=@HAVE_MYSQL@ |
---|
4 | ifeq ($(HAVE_MYSQL),yes) |
---|
5 | ALL_DEPENDS=common common_sql login login_sql char char_sql map map_sql ladmin tools converters plugins import save |
---|
6 | SQL_DEPENDS=common_sql login_sql char_sql map_sql import save |
---|
7 | COMMON_SQL_DEPENDS= |
---|
8 | LOGIN_SQL_DEPENDS=common_sql |
---|
9 | CHAR_SQL_DEPENDS=common_sql |
---|
10 | MAP_SQL_DEPENDS=common_sql |
---|
11 | CONVERTERS_DEPENDS=common_sql |
---|
12 | else |
---|
13 | ALL_DEPENDS=common login char map ladmin tools plugins import save |
---|
14 | SQL_DEPENDS=needs_mysql |
---|
15 | COMMON_SQL_DEPENDS=needs_mysql |
---|
16 | LOGIN_SQL_DEPENDS=needs_mysql |
---|
17 | CHAR_SQL_DEPENDS=needs_mysql |
---|
18 | MAP_SQL_DEPENDS=needs_mysql |
---|
19 | CONVERTERS_DEPENDS=needs_mysql |
---|
20 | endif |
---|
21 | |
---|
22 | ##################################################################### |
---|
23 | .PHONY: txt sql conf \ |
---|
24 | common common_sql \ |
---|
25 | login login_sql \ |
---|
26 | char char_sql \ |
---|
27 | map map_sql \ |
---|
28 | ladmin tools converters plugins addons import save \ |
---|
29 | clean help |
---|
30 | |
---|
31 | all: $(ALL_DEPENDS) |
---|
32 | |
---|
33 | txt: common login char map import save |
---|
34 | |
---|
35 | sql: $(SQL_DEPENDS) |
---|
36 | |
---|
37 | conf: import save |
---|
38 | |
---|
39 | common: |
---|
40 | @$(MAKE) -C src/common txt |
---|
41 | |
---|
42 | common_sql: $(COMMON_SQL_DEPENDS) |
---|
43 | @$(MAKE) -C src/common sql |
---|
44 | |
---|
45 | login: common |
---|
46 | @$(MAKE) -C src/login |
---|
47 | |
---|
48 | login_sql: $(LOGIN_SQL_DEPENDS) |
---|
49 | @$(MAKE) -C src/login_sql |
---|
50 | |
---|
51 | char: common |
---|
52 | @$(MAKE) -C src/char |
---|
53 | |
---|
54 | char_sql: $(CHAR_SQL_DEPENDS) |
---|
55 | @$(MAKE) -C src/char_sql |
---|
56 | |
---|
57 | map: common |
---|
58 | @$(MAKE) -C src/map txt |
---|
59 | |
---|
60 | map_sql: $(MAP_SQL_DEPENDS) |
---|
61 | @$(MAKE) -C src/map sql |
---|
62 | |
---|
63 | ladmin: common |
---|
64 | @$(MAKE) -C src/ladmin |
---|
65 | |
---|
66 | tools: |
---|
67 | @$(MAKE) -C src/tool |
---|
68 | |
---|
69 | converters: $(CONVERTERS_DEPENDS) |
---|
70 | @$(MAKE) -C src/txt-converter |
---|
71 | |
---|
72 | plugins addons: common |
---|
73 | @$(MAKE) -C src/plugins |
---|
74 | |
---|
75 | import: |
---|
76 | # 1) create conf/import folder |
---|
77 | # 2) add missing files |
---|
78 | # 3) remove remaining .svn folder |
---|
79 | @echo "building conf/import folder..." |
---|
80 | @if test ! -d conf/import ; then mkdir conf/import ; fi |
---|
81 | @for f in $$(ls conf/import-tmpl) ; do if test ! -e conf/import/$$f ; then cp conf/import-tmpl/$$f conf/import ; fi ; done |
---|
82 | @rm -rf conf/import/.svn |
---|
83 | |
---|
84 | save: |
---|
85 | # 1) create save folder |
---|
86 | # 2) add missing files |
---|
87 | # 3) remove remaining .svn folder |
---|
88 | @echo "building save folder..." |
---|
89 | @if test ! -d save ; then mkdir save ; fi |
---|
90 | @for f in $$(ls save-tmpl) ; do if test ! -e save/$$f ; then cp save-tmpl/$$f save ; fi ; done |
---|
91 | @rm -rf save/.svn |
---|
92 | |
---|
93 | clean: |
---|
94 | @$(MAKE) -C src/common $@ |
---|
95 | @$(MAKE) -C src/login $@ |
---|
96 | @$(MAKE) -C src/login_sql $@ |
---|
97 | @$(MAKE) -C src/char $@ |
---|
98 | @$(MAKE) -C src/char_sql $@ |
---|
99 | @$(MAKE) -C src/map $@ |
---|
100 | @$(MAKE) -C src/ladmin $@ |
---|
101 | @$(MAKE) -C src/plugins $@ |
---|
102 | @$(MAKE) -C src/tool $@ |
---|
103 | @$(MAKE) -C src/txt-converter $@ |
---|
104 | |
---|
105 | help: |
---|
106 | @echo "most common targets are 'all' 'txt' 'sql' 'conf' 'clean' 'help'" |
---|
107 | @echo "possible targets are:" |
---|
108 | @echo "'common' - builds object files used in TXT servers" |
---|
109 | @echo "'common_sql' - builds object files used in SQL servers" |
---|
110 | @echo "'login' - builds login server (TXT version)" |
---|
111 | @echo "'login_sql' - builds login server (SQL version)" |
---|
112 | @echo "'char' - builds char server (TXT version)" |
---|
113 | @echo "'char_sql' - builds char server (SQL version)" |
---|
114 | @echo "'map' - builds map server (TXT version)" |
---|
115 | @echo "'map_sql' - builds map server (SQL version)" |
---|
116 | @echo "'ladmin' - builds remote administration tool" |
---|
117 | @echo "'tools' - builds all the tools in src/tools" |
---|
118 | @echo "'converters' - builds the login/char converters" |
---|
119 | @echo "'plugins' - builds all the plugins in src/plugins" |
---|
120 | @echo "'addons'" |
---|
121 | @echo "'import' - builds conf/import folder from the template conf/import-tmpl" |
---|
122 | @echo "'save' - builds save folder from the template save-tmpl" |
---|
123 | @echo "'all' - builds all the above targets" |
---|
124 | @echo "'txt' - builds txt servers (targets 'common' 'login' 'char' 'map'" |
---|
125 | @echo " 'import' and 'save')" |
---|
126 | @echo "'sql' - builds sql servers (targets 'common_sql' 'login_sql' 'char_sql'" |
---|
127 | @echo " 'map_sql' 'import' and 'save')" |
---|
128 | @echo "'conf' - builds templated folders/files (targets 'import' and 'save')" |
---|
129 | @echo "'clean' - cleans builds and objects" |
---|
130 | @echo "'help' - outputs this message" |
---|
131 | |
---|
132 | ##################################################################### |
---|
133 | |
---|
134 | needs_mysql: |
---|
135 | @echo "MySQL not found or disabled by the configure script" |
---|
136 | @exit 1 |
---|
137 | |
---|
138 | ##################################################################### |
---|
139 | # TODO |
---|
140 | |
---|
141 | install: conf/%.conf conf/%.txt |
---|
142 | $(shell read -p "WARNING: This target does not work properly yet. Press Ctrl+C to cancel or Enter to continue.") |
---|
143 | $(shell mkdir -p /opt/eathena/bin/) |
---|
144 | $(shell mkdir -p /opt/eathena/etc/eathena/) |
---|
145 | $(shell mkdir -p /opt/eathena/var/log/eathena/) |
---|
146 | $(shell mv save /opt/eathena/etc/eathena/save) |
---|
147 | $(shell mv db /opt/eathena/etc/eathena/db) |
---|
148 | $(shell mv conf /opt/eathena/etc/eathena/conf) |
---|
149 | $(shell mv npc /opt/eathena/etc/eathena/npc) |
---|
150 | $(shell mv log/* /opt/eathena/var/log/eathena/) |
---|
151 | $(shell cp *-server* /opt/eathena/bin/) |
---|
152 | $(shell cp ladmin /opt/eathena/bin/) |
---|
153 | $(shell ln -s /opt/eathena/etc/eathena/save/ /opt/eathena/bin/) |
---|
154 | $(shell ln -s /opt/eathena/etc/eathena/db/ /opt/eathena/bin/) |
---|
155 | $(shell ln -s /opt/eathena/etc/eathena/conf/ /opt/eathena/bin/) |
---|
156 | $(shell ln -s /opt/eathena/etc/eathena/npc/ /opt/eathena/bin/) |
---|
157 | $(shell ln -s /opt/eathena/var/log/eathena/ /opt/eathena/bin/log) |
---|
158 | |
---|
159 | bin-clean: |
---|
160 | $(shell rm /opt/eathena/bin/login-server*) |
---|
161 | $(shell rm /opt/eathena/bin/char-server*) |
---|
162 | $(shell rm /opt/eathena/bin/map-server*) |
---|
163 | $(shell rm /opt/eathena/bin/ladmin) |
---|
164 | |
---|
165 | uninstall: |
---|
166 | $(shell read -p "WARNING: This target does not work properly yet. Press Ctrl+C to cancel or Enter to continue.") |
---|
167 | bin-clean |
---|
168 | $(shell rm /opt/eathena/bin/save) |
---|
169 | $(shell rm /opt/eathena/bin/db) |
---|
170 | $(shell rm /opt/eathena/bin/conf) |
---|
171 | $(shell rm /opt/eathena/bin/npc) |
---|
172 | $(shell rm /opt/eathena/bin/log) |
---|
173 | $(shell rm -rf /opt/eathena/etc/eathena) |
---|
174 | $(shell rm -rf /opt/eathena/var/log/eathena) |
---|