pcrs: Request JIT compilation if it's supported
[privoxy.git] / windows / GNUmakefile
1 ##########################################################################
2 #
3 # Written by and Copyright (C) 2002-2018 the Privoxy team.
4 # https://www.privoxy.org/
5 #
6 # This script originally written by and Copyright (C) 2002
7 # Jonathan Foster
8 #
9 # This program is free software; you can redistribute it 
10 # and/or modify it under the terms of the GNU General
11 # Public License as published by the Free Software
12 # Foundation; either version 2 of the License, or (at
13 # your option) any later version.
14 #
15 # This program is distributed in the hope that it will
16 # be useful, but WITHOUT ANY WARRANTY; without even the
17 # implied warranty of MERCHANTABILITY or FITNESS FOR A
18 # PARTICULAR PURPOSE.  See the GNU General Public
19 # License for more details.
20 #
21 # The GNU General Public License should be included with
22 # this file.  If not, you can view it at
23 # http://www.gnu.org/copyleft/gpl.html
24 # or write to the Free Software Foundation, Inc., 59
25 # Temple Place - Suite 330, Boston, MA  02111-1307, USA.
26 #
27 ##########################################################################
28
29
30 ##########################################################################
31 # External programs
32 ##########################################################################
33 SED        = sed
34 PERL       = perl
35 AWK        = awk
36 WGET       = wget
37 STRIP      = strip
38 AUTOCONF   = autoconf
39 AUTOHEADER = autoheader
40
41 # Program to copy a directory from a web site to the local disk.
42 WEBMIRROR = $(WGET) -nv -nH -nd -N -r -np
43
44 # Program to do LF->CRLF
45 #
46 # The sed version should be the most portable, but it doesn't work for me,
47 # the other two do.  FIXME.
48 #   - Jon
49 #
50 DOSFILTER = $(SED) -e $$'s,$$,\r,'
51 #DOSFILTER = $(AWK) -v ORS='\r\n' '{print $0;}'
52 #DOSFILTER = $(PERL) -p -e 's/\n/\r\n/'
53
54 # Path to NSIS
55 # MAKENSIS = ./nsis/nsis-2.30.exe
56 MAKENSIS = ./nsis-3.03/makensis.exe
57
58
59 ##########################################################################
60 # More configuration
61 ##########################################################################
62
63 # Directory containing the source code
64 SOURCE   = ..
65
66 # Directory to build an image of the installed file system in.
67 DEST     = ./build
68
69 # The name of the EXE installer (must match the name specified in
70 # the .NSI script)
71 TARGET=privoxy_setup.exe
72
73 # The NSIS script that generates the installer.
74 NSIFILE=privoxy_winthreads.nsi
75
76
77 ##########################################################################
78 # Rules
79 ##########################################################################
80
81 winrelease: $(TARGET)
82
83 winbuild: $(DEST)/privoxy.exe templates inifiles doc webdoc
84
85 clean:
86         rm -rf $(DEST) $(TARGET)
87
88 clobber: clean
89         rm -f $(TARGET) $(SOURCE)/privoxy.exe
90
91 .PHONY: winrelease winbuild clean
92
93
94 $(TARGET): $(NSIFILE) winbuild
95         $(MAKENSIS) $<
96
97 $(DEST):
98         mkdir $@
99
100 $(DEST)/templates:
101         mkdir $@
102
103 $(DEST)/doc:
104         mkdir $@
105
106 $(DEST)/%.txt: $(SOURCE)/% $(DEST)
107         $(DOSFILTER) < $< > $@ 
108
109
110 inifiles: $(DEST)/config.txt $(DEST)/match-all.action $(DEST)/default.action $(DEST)/user.action \
111           $(DEST)/default.filter $(DEST)/trust.txt $(DEST)/user.filter
112
113
114 $(DEST)/config.txt: $(SOURCE)/config $(DEST)
115         $(SED) -e 's!trustfile trust!trustfile trust.txt!' \
116                -e 's!logfile logfile!logfile privoxy.log!' \
117                -e 's!#user-manual http://www.privoxy.org/user-manual/!user-manual ./doc/user-manual/!' \
118                -e 's!#Win32-only: !!' \
119                < $< | \
120                $(DOSFILTER) > $@
121
122 $(DEST)/match-all.action: $(SOURCE)/match-all.action $(DEST)
123         $(DOSFILTER) < $< > $@
124
125 $(DEST)/default.action: $(SOURCE)/default.action $(DEST)
126         $(DOSFILTER) < $< > $@ 
127
128 $(DEST)/user.action: $(SOURCE)/user.action $(DEST)
129         $(DOSFILTER) < $< > $@ 
130
131 $(DEST)/default.filter: $(SOURCE)/default.filter $(DEST)
132         $(DOSFILTER) < $< > $@ 
133
134 $(DEST)/user.filter: $(SOURCE)/user.filter $(DEST)
135         $(DOSFILTER) < $< > $@ 
136
137 $(DEST)/privoxy.exe: $(SOURCE)/privoxy.exe $(DEST)
138         $(STRIP) -o $@ $<
139
140 $(SOURCE)/configure: $(SOURCE)/configure.in
141         cd $(SOURCE) && $(AUTOCONF)
142
143 $(SOURCE)/config.h.in: $(SOURCE)/configure $(SOURCE)/acconfig.h
144         cd $(SOURCE) && $(AUTOHEADER)
145
146 $(SOURCE)/config.h: $(SOURCE)/configure $(SOURCE)/config.h.in
147         ./MYconfigure
148
149 $(SOURCE)/privoxy.exe: $(SOURCE)/configure $(SOURCE)/config.h
150         cd $(SOURCE) && $(MAKE) clean
151         cd $(SOURCE) && $(MAKE)
152
153
154 templates: $(patsubst $(SOURCE)/%,$(DEST)/%,$(wildcard $(SOURCE)/templates/*))
155
156 $(DEST)/templates/%: $(SOURCE)/templates/% $(DEST)/templates
157         if test -f $< ; then $(DOSFILTER) < $< > $@ ; fi
158
159
160 doc: $(DEST)/AUTHORS.txt $(DEST)/README.txt $(DEST)/LICENSE.txt
161
162 webdoc: $(DEST)/doc/developer-manual $(DEST)/doc/faq $(DEST)/doc/images $(DEST)/doc/user-manual
163         cp $(SOURCE)/doc/webserver/p_doc.css $(DEST)/doc
164         cp $(SOURCE)/doc/webserver/p_doc.css $(DEST)/doc/user-manual/
165
166
167 $(DEST)/doc/gpl.html: $(SOURCE)/doc/gpl.html $(DEST)/doc
168         $(DOSFILTER) < $< > $@ 
169
170 $(DEST)/doc/%.txt : $(SOURCE)/doc/text/%.txt $(DEST)/doc
171         $(DOSFILTER) < $< > $@ 
172
173 $(DEST)/doc/developer-manual: $(DEST)/doc $(SOURCE)/doc/webserver/developer-manual/index.html
174         test -d $(DEST)/doc/developer-manual || mkdir $(DEST)/doc/developer-manual
175         cp    $(SOURCE)/doc/webserver/developer-manual/*.html $(DEST)/doc/developer-manual/
176
177 $(DEST)/doc/user-manual: $(DEST)/doc $(SOURCE)/doc/webserver/user-manual/index.html
178         test -d $(DEST)/doc/user-manual      || mkdir $(DEST)/doc/user-manual
179         cp    $(SOURCE)/doc/webserver/user-manual/*.html $(DEST)/doc/user-manual/
180
181 $(DEST)/doc/faq: $(DEST)/doc $(SOURCE)/doc/webserver/faq/index.html
182         test -d $(DEST)/doc/faq              || mkdir $(DEST)/doc/faq
183         cp    $(SOURCE)/doc/webserver/faq/*.html $(DEST)/doc/faq/
184
185 $(DEST)/doc/images: $(DEST)/doc
186         cp -r $(SOURCE)/doc/webserver/images/ $(DEST)/doc
187
188 ##########################################################################
189 # That's all, folks!
190 ##########################################################################
191