root/main/trunk/greenstone2/common-src/win32.mak @ 33117

Revision 33117, 7.9 KB (checked in by ak19, 17 months ago)

Fixed an issue on Windows when compiling the the src component: crypt.zip may not have unpacked, in which case ant distclean will fail. So first check the crypt subdir exsts before attempting to cd into it to run clean in it.

Line 
1###########################################################################
2#
3# win32 makefile -- common code between gsdl runtime and buildtime
4# A component of the Greenstone digital library software
5# from the New Zealand Digital Library Project at the
6# University of Waikato, New Zealand.
7#
8# Copyright (C) 1999  The New Zealand Digital Library Project
9#
10#
11# This program is free software; you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
13# the Free Software Foundation; either version 2 of the License, or
14# (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with this program; if not, write to the Free Software
23# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24#
25###########################################################################
26
27!IF "$(GSDLHOME)"==""
28GSDLHOME = $(MAKEDIR)
29!ELSE
30GSDLHOME = $(GSDLHOME)
31!ENDIF
32COMMONHOME = $(MAKEDIR)
33GSDL_VC4 = 0
34DEBUG = 0
35DLL = 0
36DLLDEBUG = 0
37USE_GDBM = 1
38USE_JDBM = 1
39USE_SQLITE = 1
40USE_MSSQL = 0
41# by default, all indexers are enabled
42ENABLE_MG = 1
43ENABLE_MGPP = 1
44ENABLE_LUCENE = 1
45# jni is disabled by default as this is the default for GS2. GS3 will set this explicitly
46ENABLE_JNI = 0
47
48MDEFINES = /f win32.mak
49
50INDEXERSDIR = indexers
51
52COMPILEDIRS = cgi-bin packages\windows\crypt\crypt \
53          packages\search4j src\lib
54
55INSTALLDIRS = cgi-bin packages\expat
56
57#    src\getpw
58
59PACKAGEDIRS =
60
61EXPAT_DIR = packages\expat\expat-1.95.8
62SQLITE_DIR = packages\sqlite\sqlite-autoconf-3070602
63JDBM_DIR = packages\jdbm
64JDBMEDIT_DIR = src\jdbmedit
65
66MAKECMD = $(MAKE) $(MDEFINES) GSDLHOME="$(GSDLHOME)" BINDIR="$(GSDLHOME)\bin\windows"
67
68!IF $(GSDL_VC4)
69MAKECMD = $(MAKECMD) GSDL_VC4=1
70!ENDIF
71!IF $(DEBUG)
72MAKECMD = $(MAKECMD) DEBUG=1
73!ENDIF
74!IF $(DLL)
75MAKECMD = $(MAKECMD) DLL=1
76!ENDIF
77!IF $(DLLDEBUG)
78MAKECMD = $(MAKECMD) DLLDEBUG=1
79!ENDIF
80!IF $(ENABLE_JNI)
81MAKECMD = $(MAKECMD) ENABLE_JNI=1
82!ENDIF
83!IF !$(ENABLE_MG)
84MAKECMD = $(MAKECMD) ENABLE_MG=0
85!ENDIF
86!IF !$(ENABLE_MGPP)
87MAKECMD = $(MAKECMD) ENABLE_MGPP=0
88!ENDIF
89!IF !$(ENABLE_LUCENE)
90MAKECMD = $(MAKECMD) ENABLE_LUCENE=0
91!ENDIF
92
93!IF $(USE_GDBM)
94GDBM_DEFINES = -DUSE_GDBM
95COMPILEDIRS = $(COMPILEDIRS) \
96    packages\gdbm\gdbm-1.8.3
97INSTALLDIRS = $(INSTALLDIRS) src\gdbmedit\db2txt src\gdbmedit\txt2db \
98    src\gdbmedit\gdbmset src\gdbmedit\gdbmget \
99    src\gdbmedit\gdbmkeys src\gdbmedit\gdbmdel
100!ELSE
101GDBM_DEFINES =
102MAKECMD = $(MAKECMD) USE_GDBM=0
103!ENDIF
104
105!IF $(USE_JDBM)
106JDBM_DEFINES = -DUSE_JDBM
107PACKAGEDIRS = $(PACKAGEDIRS) $(JDBM_DIR)
108!ELSE
109JDBM_DEFINES =
110MAKECMD = $(MAKECMD) USE_JDBM=0
111!ENDIF
112
113!IF $(USE_SQLITE)
114SQLITE_DEFINES = -DUSE_SQLITE
115PACKAGEDIRS = $(PACKAGEDIRS) $(SQLITE_DIR)
116!ELSE
117SQLITE_DEFINES =
118MAKECMD = $(MAKECMD) USE_SQLITE=0
119!ENDIF
120
121!IF $(USE_MSSQL)
122MSSQL_DEFINES = -DUSE_MSSQL
123MAKECMD = $(MAKECMD) USE_MSSQL=1
124!ELSE
125MSSQL_DEFINES =
126!ENDIF
127
128MAKECLEANCMD = $(MAKE) $(MDEFINES) GSDLHOME="$(GSDLHOME)" clean
129
130all: win32.mak unzip $(INDEXERSDIR) $(PACKAGEDIRS) $(COMPILEDIRS) $(INSTALLDIRS) $(JDBMEDIT_DIR)
131
132install: win32.mak $(INDEXERSDIR) $(INSTALLDIRS)
133
134unzip:
135    cd "$(COMMONHOME)"
136    cd packages\windows\crypt
137    if NOT EXIST "crypt" unzip crypt.zip
138    cd "$(COMMONHOME)"
139    IF NOT EXIST $(EXPAT_DIR) IF EXIST "$(GSDLHOME)\bin\windows\gunzip.exe" IF EXIST "$(GSDLHOME)\bin\windows\tar.exe" "$(GSDLHOME)\bin\windows\gunzip.exe" -cd "$(EXPAT_DIR).tar.gz" | "$(GSDLHOME)\bin\windows\tar.exe" xv --directory=./packages/expat
140    @IF NOT EXIST $(EXPAT_DIR) echo ****** Couldn't extract archive $(EXPAT_DIR).tar.gz. Extract it manually, or check that gunzip.exe and tar.exe exist in GSDLHOME\bin\windows. ******
141    @IF NOT EXIST $(EXPAT_DIR) exit /b 1
142    cd "$(COMMONHOME)"
143    cd indexers\packages\windows\iconv
144    if NOT EXIST "iconv" unzip iconv.zip
145    cd "$(COMMONHOME)"
146
147!IF "$(USE_SQLITE)" == "1"
148    IF NOT EXIST $(SQLITE_DIR) IF EXIST "$(GSDLHOME)\bin\windows\gunzip.exe" IF EXIST "$(GSDLHOME)\bin\windows\tar.exe" "$(GSDLHOME)\bin\windows\gunzip.exe" -cd "$(SQLITE_DIR).tar.gz" | "$(GSDLHOME)\bin\windows\tar.exe" xv --directory=./packages/sqlite
149    @IF NOT EXIST $(SQLITE_DIR) echo ****** Couldn't extract archive $(SQLITE_DIR).tar.gz. Extract it manually, or check that gunzip.exe and tar.exe exist in GSDLHOME\bin\windows. ******
150    @IF NOT EXIST $(SQLITE_DIR) exit /b 1
151    cd "$(COMMONHOME)"
152!ENDIF
153
154!IF "$(USE_JDBM)" == "1"
155    IF NOT EXIST $(JDBM_DIR)\jdbm-1.0 IF EXIST "$(GSDLHOME)\bin\windows\gunzip.exe" IF EXIST "$(GSDLHOME)\bin\windows\tar.exe" "$(GSDLHOME)\bin\windows\gunzip.exe" -cd "$(JDBM_DIR)\gs-jdbm-1.0.tar.gz" | "$(GSDLHOME)\bin\windows\tar.exe" xv --directory=./packages/jdbm
156    @IF NOT EXIST $(JDBM_DIR)\jdbm-1.0 echo ****** Couldn't extract archive $(JDBM_DIR)\gs-jdbm-1.0.tar.gz. Extract it manually, or check that gunzip.exe and tar.exe exist in GSDLHOME\bin\windows. ******
157    @IF NOT EXIST $(JDBM_DIR)\jdbm-1.0 exit /b 1
158!ENDIF
159
160clean:
161    cd "$(COMMONHOME)"
162    cd cgi-bin
163    $(MAKECLEANCMD)
164    cd "$(COMMONHOME)"
165    IF EXIST cd packages\windows\crypt\crypt cd packages\windows\crypt\crypt
166    $(MAKECLEANCMD)
167!IF EXIST ("packages\gdbm\gdbm-1.8.3")
168    cd "$(COMMONHOME)"
169    cd packages\gdbm\gdbm-1.8.3
170    $(MAKECLEANCMD)
171!ENDIF
172    cd "$(COMMONHOME)"
173!IF EXIST (packages\expat)
174    cd packages\expat
175    $(MAKECLEANCMD)
176    cd "$(COMMONHOME)"
177!ENDIF 
178    cd src\lib
179    $(MAKECLEANCMD)
180!IF EXIST ("src\gdbmedit")
181    cd "$(COMMONHOME)"
182    cd src\gdbmedit\txt2db
183    $(MAKECLEANCMD)
184    cd "$(COMMONHOME)"
185    cd src\gdbmedit\db2txt
186    $(MAKECLEANCMD)
187    cd "$(COMMONHOME)"
188    cd src\gdbmedit\gdbmget
189    $(MAKECLEANCMD)
190    cd "$(COMMONHOME)"
191    cd src\gdbmedit\gdbmset
192    $(MAKECLEANCMD)
193    cd "$(COMMONHOME)"
194    cd src\gdbmedit\gdbmkeys
195    $(MAKECLEANCMD)
196    cd "$(COMMONHOME)"
197    cd src\gdbmedit\gdbmdel
198    $(MAKECLEANCMD)
199!ENDIF
200#   cd "$(COMMONHOME)"
201#   cd src\getpw
202#   $(MAKECLEANCMD)
203    cd "$(COMMONHOME)"
204    cd indexers
205    set DEBUG=$(DEBUG)
206    set ENABLE_MG=$(ENABLE_MG)
207    set ENABLE_MGPP=$(ENABLE_MGPP)
208    set ENABLE_LUCENE=$(ENABLE_LUCENE)
209    call winMake.bat clean
210    set DEBUG=
211    set ENABLE_MG=
212    set ENABLE_MGPP=
213    set ENABLE_LUCENE=
214    cd "$(COMMONHOME)"
215    cd packages\search4j
216    $(MAKECLEANCMD)
217!IF EXIST ("$(SQLITE_DIR)")
218    cd "$(COMMONHOME)"
219    cd "$(SQLITE_DIR)"
220    $(MAKECLEANCMD)
221    if exist "$(COMMONHOME)\packages\sqlite\lib\sqlite3.lib" del "$(COMMONHOME)\packages\sqlite\lib\sqlite3.lib"
222!ENDIF
223    cd "$(COMMONHOME)" 
224
225$(COMPILEDIRS): FORCE
226    cd "$(COMMONHOME)"
227    cd "$@"
228    $(MAKECMD)
229    cd "$(GSDLHOME)"
230
231!IF "$(INSTALLDIRS)" != ""
232$(INSTALLDIRS): FORCE
233    cd "$(COMMONHOME)"
234    cd "$@"
235    $(MAKECMD)
236    $(MAKECMD) install
237    cd "$(COMMONHOME)"
238!ENDIF
239
240$(SQLITE_DIR): FORCE
241    cd "$(COMMONHOME)"
242    cd "$@"
243    $(MAKECMD)
244    $(MAKECMD) install
245    cd "$(COMMONHOME)"
246
247$(JDBM_DIR): FORCE
248    cd "$(COMMONHOME)\$(JDBM_DIR)\jdbm-1.0"
249    set DEBUG=$(DEBUG)
250    call winMake.bat all
251    call winMake.bat install   
252    set DEBUG=
253
254$(JDBMEDIT_DIR): FORCE
255!IF "$(USE_JDBM)" == "1"
256    cd "$(COMMONHOME)"
257    cd "$@"
258    set DEBUG=$(DEBUG)
259    call winMake.bat all
260    call winMake.bat install   
261    set DEBUG=
262!ENDIF
263
264$(INDEXERSDIR): FORCE
265    cd "$(COMMONHOME)"
266    cd "$@"
267    set DEBUG=$(DEBUG)
268    set ENABLE_MG=$(ENABLE_MG)
269    set ENABLE_MGPP=$(ENABLE_MGPP)
270    set ENABLE_LUCENE=$(ENABLE_LUCENE)
271
272!IF $(ENABLE_JNI)
273    call winMake.bat all with-jni
274    call winMake.bat install with-jni
275!ELSE
276    call winMake.bat all without-jni
277    call winMake.bat install without-jni
278!ENDIF
279
280    set DEBUG=
281    set ENABLE_MG=
282    set ENABLE_MGPP=
283    set ENABLE_LUCENE=
284    if NOT EXIST "$(GSDLHOME)\bin\windows" mkdir "$(GSDLHOME)\bin\windows"
285    if NOT EXIST "$(GSDLHOME)\bin\java" mkdir "$(GSDLHOME)\bin\java"
286    for %%i in (bin\*.exe) do \
287      if exist %%i copy %%i "$(GSDLHOME)\bin\windows"
288    if EXIST "lucene-gs\LuceneWrapper4.jar" copy "lucene-gs\LuceneWrapper4.jar" "$(GSDLHOME)\bin\java"
289    @if NOT EXIST "lucene-gs\LuceneWrapper4.jar" echo Warning: Failed to find lucene-gs\LuceneWrapper4.jar. Greenstone will not be able to use Lucene for indexing
290    cd "$(GSDLHOME)"
291
292FORCE:
293
Note: See TracBrowser for help on using the browser.