1 ##############################################################################
4 ## Copyright (C) 2007-2008 ##
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. ##
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. ##
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 ##############################################################################
27 BUILD_DIR
= .build
/$(shell echo
$(MODE
) | tr
[[:upper
:]] [[:lower
:]])
28 GNATMAKE_OPTIONS
= -XPRJ_BUILD
=$(MODE
)
33 GNAT_ROOT
= $(dir $(shell which gnatls
))..
38 prefix = $(shell cat
$(BUILD_DIR
)/gnat.root
2>/dev
/null
)
41 ifeq (,$(ARGWIAD_ROOT
))
42 ARGWIAD_ROOT
= $(shell echo
$$ARGWIAD_ROOT)
45 # Add GPR Library_Kind for AWS (force to shared)
46 GNATMAKE_OPTIONS
+= -XLIBRARY_TYPE
=relocatable
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
58 PROGRAMS
+= bin
/diouzhtu2html
61 LIBRARIES
+= wiki_service
62 LIBRARIES
+= wiki_website
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
)
80 DISTRIB_OS
= win32-
$(uname_M
)
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
)
90 DISTRIB
= $(shell pwd
)/diouzhtu-
$(DISTRIB_OS
)-$(VERSION_ALL
)
92 bin
/diouzhtu2html
: bld-diouzhtu2html
/diouzhtu2html
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
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
122 $(shell echo
$(GNAT_ROOT
) > $(BUILD_DIR
)/gnat.root
)
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
132 diff
$(BUILD_DIR
)/test/example.html \
133 diouzhtu2html
/test/example.html
134 @echo
"diouzhtu2html regression test OK !"
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
/
151 $(RM
) -rf
$(BUILD_DIR
)
153 $(CLEAN_PROJECTS
): clean-
% :
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
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
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
); \
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
); \
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 ?"; \
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
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
))
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