Remove -s binder switch.
[diouzhtu.git] / Makefile
blobcaafb5ccaff64819e3e991be5c97d4235b1d5f0a
1 ##############################################################################
2 ## Diouzhtu ##
3 ## ##
4 ## Copyright (C) 2007-2008 ##
5 ## Olivier Ramonat ##
6 ## ##
7 ## This library is free software; you can redistribute it and/or modify ##
8 ## it under the terms of the GNU General Public License as published by ##
9 ## the Free Software Foundation; either version 2 of the License, or (at ##
10 ## your option) any later version. ##
11 ## ##
12 ## This library is distributed in the hope that it will be useful, but ##
13 ## WITHOUT ANY WARRANTY; without even the implied warranty of ##
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ##
15 ## General Public License for more details. ##
16 ## ##
17 ## You should have received a copy of the GNU General Public License ##
18 ## along with this library; if not, write to the Free Software Foundation, ##
19 ## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ##
20 ##############################################################################
22 all::
24 # Root dir
25 MODE = Release
26 JOBS = 1
27 BUILD_DIR = .build/$(shell echo $(MODE) | tr [[:upper:]] [[:lower:]])
28 GNATMAKE_OPTIONS = -XPRJ_BUILD=$(MODE)
29 VALGRIND =
30 TAR_DIR = tar czf
32 # Install prefix
33 GNAT_ROOT = $(dir $(shell which gnatls))..
34 ARGWIAD_ROOT =
35 prefix =
37 ifeq (,$(prefix))
38 prefix = $(shell cat $(BUILD_DIR)/gnat.root 2>/dev/null)
39 endif
41 ifeq (,$(ARGWIAD_ROOT))
42 ARGWIAD_ROOT = $(shell echo $$ARGWIAD_ROOT)
43 endif
45 # Add GPR Library_Kind for AWS (force to shared)
46 GNATMAKE_OPTIONS += -XLIBRARY_TYPE=relocatable
48 GNAT = gnat
49 GNATMAKE = $(GNAT) make -p -j$(JOBS) $(GNATMAKE_OPTIONS)
50 GNATCLEAN = $(GNAT) clean $(GNATMAKE_OPTIONS)
51 GNATCHECK = $(GNAT) check $(GNATMAKE_OPTIONS) -rules -from=diouzhtu.check
52 RM = rm -f
53 LN = ln
54 CP = cp -p
55 MKDIR = mkdir -p
57 PROGRAMS =
58 PROGRAMS += bin/diouzhtu2html
60 LIBRARIES =
61 LIBRARIES += wiki_service
62 LIBRARIES += wiki_website
64 GPR =
65 GPR += diouzhtu2html/diouzhtu2html
66 GPR += gwiad_wiki_service/service/wiki_service
67 GPR += gwiad_wiki_service/website/wiki_website
69 BLD_GPR := $(addprefix bld-, $(GPR))
70 CLN_GPR := $(addprefix cln-, $(GPR))
71 CHK_GPR := $(addprefix chk-, $(GPR))
73 uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
75 VERSION_ALL = $(shell git describe 2>/dev/null)
77 ifeq (${OS},Windows_NT)
78 LIBEXT = .dll
79 EXEEXT = .exe
80 DISTRIB_OS = win32-$(uname_M)
81 else
82 LIBEXT = .so
83 uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
84 uname_S_lower := $(shell sh -c \
85 'uname -s 2>/dev/null \
86 | tr [[:upper:]] [[:lower:]] || echo not')
88 DISTRIB_OS = $(uname_S_lower)-$(uname_M)
89 endif
90 DISTRIB = $(shell pwd)/diouzhtu-$(DISTRIB_OS)-$(VERSION_ALL)
92 bin/diouzhtu2html : bld-diouzhtu2html/diouzhtu2html
93 @$(RM) $@
94 -@$(LN) $(BUILD_DIR)/d2h/obj/diouzhtu2html $@
96 wiki_service : bld-gwiad_wiki_service/service/wiki_service
97 wiki_website : $(BUILD_DIR)/wweb/tsrc/wiki_website-template_defs.ads \
98 bld-gwiad_wiki_service/website/wiki_website
100 all:: mkdirs $(PROGRAMS) $(LIBRARIES) prepare_install
102 $(BLD_GPR): bld-% :
103 $(GNATMAKE) -P$*
105 $(CLN_GPR): cln-% :
106 $(GNATCLEAN) -P$*
108 $(CHK_GPR): chk-% :
109 $(GNATCHECK) -P$*
111 mkdirs:
112 $(MKDIR) bin
113 $(MKDIR) $(BUILD_DIR)/d
114 $(MKDIR) $(BUILD_DIR)/d2h
115 $(MKDIR) $(BUILD_DIR)/wi
116 $(MKDIR) $(BUILD_DIR)/ws
117 $(MKDIR) $(BUILD_DIR)/wweb/gen
118 $(MKDIR) $(BUILD_DIR)/wweb/tsrc/
119 $(MKDIR) $(BUILD_DIR)/slib
121 prepare_install:
122 $(shell echo $(GNAT_ROOT) > $(BUILD_DIR)/gnat.root)
124 regtests:
125 $(RM) -r $(BUILD_DIR)/test
126 $(MKDIR) $(BUILD_DIR)/test
127 @$(VALGRIND) bin/diouzhtu2html diouzhtu2html/test/example.txt \
128 $(BUILD_DIR)/test/example.html
129 ifeq ($(OS),Windows_NT)
130 dos2unix $(BUILD_DIR)/test/example.html
131 endif
132 diff $(BUILD_DIR)/test/example.html \
133 diouzhtu2html/test/example.html
134 @echo "diouzhtu2html regression test OK !"
136 regtests_valgrind:
137 $(MAKE) regtests VALGRIND=valgrind
139 gnatcheck: $(CHK_GPR)
141 $(BUILD_DIR)/wweb/tsrc/wiki_website-template_defs.ads :
142 templates2ada -r -d gwiad_wiki_service/website/templates \
143 -o $(BUILD_DIR)/wweb/gen/templates.cds \
144 -t gwiad_wiki_service/website/templates/templates.tads
145 gnat chop -wpq $(BUILD_DIR)/wweb/gen/templates.cds \
146 $(BUILD_DIR)/wweb/tsrc/
148 clean: $(CLN_GPR)
150 clean_all:
151 $(RM) -rf $(BUILD_DIR)
153 $(CLEAN_PROJECTS): clean-% :
154 $(GNATCLEAN) $*
156 # Install directories
158 I_BIN = $(prefix)/bin
159 I_INC = $(prefix)/include/diouzhtu
160 I_INC_W = $(prefix)/include/wiki_interface
161 I_LIB = $(prefix)/lib/
162 I_LIB_D = $(prefix)/lib/diouzhtu
163 I_LIB_W = $(prefix)/lib/wiki_interface
164 I_GPR = $(prefix)/lib/gnat
165 I_DLIB = $(prefix)/share/diouzhtu/dlib
167 PLUGIN_DISTRIB = gwiad_wiki_plugin
169 install_clean:
170 $(RM) -fr $(I_INC)
171 $(RM) -fr $(I_LIB_D)
172 $(RM) -fr $(I_LIB_W)
173 $(RM) -fr $(I_INC_W)
174 $(RM) -fr $(I_DLIB)
175 $(RM) -f $(I_LIB)/*diouzhtu$(LIBEXT)
176 $(RM) -f $(I_LIB)/*wiki_interface$(LIBEXT)
177 $(RM) -f $(I_GPR)/diouzhtu.gpr
179 install_dirs: install_clean
180 $(MKDIR) $(I_BIN)
181 $(MKDIR) $(I_INC)
182 $(MKDIR) $(I_INC_W)
183 $(MKDIR) $(I_LIB_D)
184 $(MKDIR) $(I_LIB_W)
185 $(MKDIR) $(I_GPR)
186 $(MKDIR) $(I_DLIB)
188 install: install_dirs
189 $(CP) $(BUILD_DIR)/d/lib/* $(I_LIB_D)
190 for library in `ls $(I_LIB_D)/*$(LIBEXT)`; do \
191 $(RM) $(I_BIN)/$$(basename $$library); \
192 $(LN) $$library $(I_BIN); \
193 done
194 $(CP) $(BUILD_DIR)/wi/lib/* $(I_LIB_W)
195 for library in `ls $(I_LIB_W)/*$(LIBEXT)`; do \
196 $(RM) $(I_BIN)/$$(basename $$library); \
197 $(LN) $$library $(I_BIN); \
198 done
199 $(CP) diouzhtu/src/*.ad[sb] $(I_INC)
200 $(CP) gwiad_wiki_service/interface/src/*.ads $(I_INC_W)
201 $(CP) $(BUILD_DIR)/slib/services/*$(LIBEXT) $(I_DLIB)
202 $(CP) $(BUILD_DIR)/slib/websites/*$(LIBEXT) $(I_DLIB)
203 $(CP) config/projects/diouzhtu.gpr $(I_GPR)
204 $(CP) config/projects/wiki_interface.gpr $(I_GPR)
206 install_gwiad_plugins:
207 @if test ! "$(ARGWIAD_ROOT)"; then \
208 echo "NO ARGWIAD_ROOT ?"; \
209 exit 1; \
211 $(MKDIR) $(ARGWIAD_ROOT)/bin/
212 $(MKDIR) $(ARGWIAD_ROOT)/lib/services
213 $(MKDIR) $(ARGWIAD_ROOT)/lib/websites
214 $(MKDIR) $(ARGWIAD_ROOT)/plugins/wiki_website/example/templates/
215 $(MKDIR) $(ARGWIAD_ROOT)/plugins/wiki_website/example/css
216 $(MKDIR) $(ARGWIAD_ROOT)/plugins/wiki_website/example/js
217 $(CP) $(BUILD_DIR)/d/lib/*$(LIBEXT) $(ARGWIAD_ROOT)/bin/
218 $(CP) $(BUILD_DIR)/wi/lib/*wiki_interface$(LIBEXT) $(ARGWIAD_ROOT)/bin/
219 $(CP) $(BUILD_DIR)/slib/services/*wiki_service$(LIBEXT) \
220 $(ARGWIAD_ROOT)/lib/services
221 $(CP) gwiad_wiki_service/website/config/config.ini \
222 $(ARGWIAD_ROOT)/plugins/wiki_website/example/
223 $(CP) gwiad_wiki_service/website/templates/*.thtml \
224 $(ARGWIAD_ROOT)/plugins/wiki_website/example/templates/
225 $(CP) gwiad_wiki_service/website/css/*.css \
226 $(ARGWIAD_ROOT)/plugins/wiki_website/example/css/
227 $(CP) external_libraries/highlight/*.js \
228 $(ARGWIAD_ROOT)/plugins/wiki_website/example/js/
229 $(CP) -r external_libraries/highlight/languages \
230 $(ARGWIAD_ROOT)/plugins/wiki_website/example/js/
231 $(CP) $(BUILD_DIR)/slib/websites/*wiki_website$(LIBEXT) \
232 $(ARGWIAD_ROOT)/lib/websites
234 distrib-bin:
235 $(MAKE) install_gwiad_plugins ARGWIAD_ROOT=$(DISTRIB)/dist
236 (cd $(DISTRIB)/dist; $(TAR_DIR) ../dist.tgz .)
237 $(RM) -r $(DISTRIB)/dist
238 $(CP) gwiad_wiki_service/scripts/do-install.sh $(DISTRIB)
239 $(TAR_DIR) $(shell basename $(DISTRIB)).tgz $(shell basename $(DISTRIB))
240 $(RM) -r $(DISTRIB)
242 dist:
243 git archive --prefix="$(shell basename $(PWD))/" --format=tar HEAD \
244 | gzip > "$(shell basename $(PWD))-$(VERSION_ALL)-src.tgz"
246 .PHONY: all install clean strip regtests gnatcheck
247 .PHONY: mkdirs prepare_install
248 .PHONY: install_dirs install_clean install
249 ,PHONY: diouzhtu2html
251 .SILENT: mkdirs