edeacfcfebdba1c21cdc747fdf7fe48afb5113af
[privoxy.git] / GNUmakefile.in
1 # Note:  Makefile is built automatically from Makefile.in
2 #
3 # $Id: GNUmakefile.in,v 1.19 2002/03/22 20:53:03 morcego Exp $
4 #
5 # Written by and Copyright (C) 2001 the SourceForge
6 # IJBSWA team.  http://ijbswa.sourceforge.net
7 #
8 # Based on the Internet Junkbuster originally written
9 # by and Copyright (C) 1997 Anonymous Coders and 
10 # Junkbusters Corporation.  http://www.junkbusters.com
11 #
12 # This program is free software; you can redistribute it 
13 # and/or modify it under the terms of the GNU General
14 # Public License as published by the Free Software
15 # Foundation; either version 2 of the License, or (at
16 # your option) any later version.
17 #
18 # This program is distributed in the hope that it will
19 # be useful, but WITHOUT ANY WARRANTY; without even the
20 # implied warranty of MERCHANTABILITY or FITNESS FOR A
21 # PARTICULAR PURPOSE.  See the GNU General Public
22 # License for more details.
23 #
24 # The GNU General Public License should be included with
25 # this file.  If not, you can view it at
26 # http://www.gnu.org/copyleft/gpl.html
27 # or write to the Free Software Foundation, Inc., 59
28 # Temple Place - Suite 330, Boston, MA  02111-1307, USA.
29 #
30 # $Log: GNUmakefile.in,v $
31 # Revision 1.19  2002/03/22 20:53:03  morcego
32 # - Ongoing process to change name to JunkbusterNG
33 # - configure/configure.in: no change needed
34 # - GNUmakefile.in:
35 #         - TAR_ARCH = /tmp/JunkbusterNG-$(RPM_VERSION).tar.gz
36 #         - PROGRAM    = jbng@EXEEXT@
37 #         - rh-spec now references as junkbusterng-rh.spec
38 #         - redhat-upload: references changed to junkbusterng-* (package names)
39 #         - tarball-dist: references changed to JunkbusterNG-distribution-*
40 #         - tarball-src: now JunkbusterNG-*
41 #         - install: initscript now junkbusterng.init and junkbusterng (when
42 #                    installed)
43 # - junkbuster-rh.spec: renamed to junkbusterng-rh.spec
44 # - junkbusterng.spec:
45 #         - References to the expression ijb where changed where possible
46 #         - New package name: junkbusterng (all in lower case, acording to
47 #           the LSB recomendation)
48 #         - Version changed to: 2.9.13
49 #         - Release: 1
50 #         - Added: junkbuster to obsoletes and conflicts (Not sure this is
51 #           right. If it obsoletes, why conflict ? Have to check it later)
52 #         - Summary changed: Stefan, please check and aprove it
53 #         - Changes description to use the new name
54 #         - Sed string was NOT changed. Have to wait to the manpage to
55 #           change first
56 #         - Keeping the user junkbuster for now. It will require some aditional
57 #           changes on the script (scheduled for the next specfile release)
58 #         - Added post entry to move the old logfile to the new log directory
59 #         - Removing "chkconfig --add" entry (not good to have it automaticaly
60 #           added to the startup list).
61 #         - Added preun section to stop the service with the old name, as well
62 #           as remove it from the startup list
63 #         - Removed the chkconfig --del entry from the conditional block on
64 #           the preun scriptlet (now handled on the %files section)
65 # - junkbuster.init: renamed to junkbusterng.init
66 # - junkbusterng.init:
67 #         - Changed JB_BIN to jbng
68 #         - Created JB_OBIN with the old value of JB_BIN (junkbuster), to
69 #           be used where necessary (config dir)
70 #
71 # Aditional notes:
72 # - The config directory is /etc/junkbuster yet. Have to change it on the
73 # specfile, after it is changes on the code
74 # - The only files that got renamed on the cvs tree were the rh specfile and
75 # the init file. Some file references got changes on the makefile and on the
76 # rh-spec (as listed above)
77 #
78 # Revision 1.18  2002/03/21 23:00:00  swa
79 # want to autogenerate stuff.
80 #
81 # Revision 1.17  2002/03/19 19:30:04  morcego
82 # - Fixing stylesheet checking on configure. If it is found, no further checks
83 #   should be done
84 #
85 # - configure will now check for db2html or docbook2html (should work now
86 #   on SuSe without the docbktls package)
87 #
88 # Revision 1.16  2002/03/14 22:32:32  hal9
89 # Bumped the RPM version.
90 #
91 # Revision 1.15  2002/03/08 20:00:28  swa
92 # some leftovers.
93 #
94 # Revision 1.14  2002/03/07 18:25:56  swa
95 # synced redhat and suse build process
96 #
97 # Revision 1.13  2002/03/07 17:17:56  oes
98 # (Hopefully) fixed for older make versions
99 #
100 # Revision 1.12  2002/03/07 15:28:27  swa
101 # more informative
102 #
103 # Revision 1.11  2002/03/06 14:33:18  sarantis
104 # Use proper temp file, not "abc".
105 #
106 # Revision 1.10  2002/03/06 14:19:35  sarantis
107 # Cleanup PID_FILE_PATH from redhat-dist target
108 #
109 # Revision 1.9  2002/03/05 17:31:11  morcego
110 # Search for docbook.dsl. Should solve portability problems for SuSe.
111 #
112 # Revision 1.8  2002/03/05 14:07:42  morcego
113 # configure now detects rpm topdir, and change GNUmakefile acordingly
114 #    (based on sugestion by Sarantis Paskalis)
115 #
116 # Revision 1.7  2002/03/05 13:43:28  morcego
117 # Checking for text browser, so redhat-dok can work.
118 #
119 # Revision 1.6  2002/03/05 13:10:51  morcego
120 # Changes to implement redhat-dok (Hal Burgiss)
121 # Changes to make it work on other distros and out-of-the-shelf configurations
122 #
123 # Revision 1.5  2002/02/27 15:30:39  hal9
124 # Reset $(RPM_PACKAGEV) to 1 (was 2)
125 #
126 # Revision 1.4  2002/01/17 21:44:04  jongfoster
127 # Adding urlmatch.[ch]
128 #
129 # Revision 1.3  2002/01/04 15:26:08  oes
130 # Added tarball-src target
131 #
132 # Revision 1.2  2001/12/30 14:07:31  steudten
133 # - Add signal handling (unix)
134 # - Add SIGHUP handler (unix)
135 # - Add creation of pidfile (unix)
136 # - Add action 'top' in rc file (RH)
137 # - Add entry 'SIGNALS' to manpage
138 # - Add exit message to logfile (unix)
139 #
140 # Revision 1.1  2001/12/01 11:22:57  jongfoster
141 # Renaming Makefile.in to GNUmakefile.in so that non-GNU versions of
142 # make break in a more obvious way.
143 # Adding .PHONY section.
144 #
145 # Revision 1.40  2001/12/01 00:24:11  jongfoster
146 # Renaming various config files
147 # Fixing CR->CRLF under Win32 (I hope)
148 #
149 # Revision 1.39  2001/11/06 12:07:30  steudten
150 # Add --clean for building rpm in target redhat-dist.
151 #
152 # Revision 1.38  2001/11/05 21:35:23  steudten
153 # Complete rewrite for the 'redhat-dist' target.
154 # Checks for writeable RPM build directories for calling user.
155 # So you must not be root, just set the modes to 1777 to
156 # build a RH package.
157 # Fix the upload-target to be arch independant.
158 # Add target for 'solaris-dist' - coming soon.
159 #
160 # Revision 1.37  2001/11/01 00:52:04  hal9
161 # Redhat-upload stuff per Stefan.
162 #
163 # Revision 1.36  2001/10/31 19:26:13  swa
164 # automate process of uploading new releases
165 # to sf.
166 #
167 # Revision 1.35  2001/10/15 22:14:59  joergs
168 # Removed -O2 and -Wall from AmigaOS-only CFLAGS since they are now in
169 #  the general CFLAGS already.
170 #
171 # Revision 1.34  2001/10/15 18:28:06  steudten
172 # remove config.cache for target clobber.
173 # Cleanup make dist for RH and S.u.S.E.
174 #
175 # Revision 1.33  2001/10/10 12:43:33  oes
176 # Added ugly hack to make install target work at least for some setups.
177 #
178 # Revision 1.32  2001/10/09 22:38:19  jongfoster
179 # Correcting actionsfile filename for Win32 INI build
180 #
181 # Revision 1.31  2001/09/23 10:13:48  swa
182 # upload process established. run make webserver and
183 # the documentation is moved to the webserver. documents
184 # are now linked correctly.
185 #
186 # Revision 1.30  2001/09/19 17:55:49  oes
187 # Fixed CFLAGS
188 #
189 # Revision 1.29  2001/09/16 17:34:27  jongfoster
190 # Removing showargs.[ch], adding cgi(simple|edit).[ch]
191 # Replacing $(OBJEXT) with @OBJEXT@ - this seems to be a common source
192 # of build problems.
193 #
194 # Revision 1.28  2001/09/13 15:19:08  swa
195 # we want text files as well.
196 #
197 # Revision 1.27  2001/09/13 13:11:37  steudten
198 #
199 # Replace DEBUG_CFLAGS with OTHER_CFLAGS
200 #
201 # Revision 1.26  2001/09/12 23:44:54  david__schmidt
202 # Mac OSX (Darwin) support added.
203 #
204 # Revision 1.25  2001/09/12 22:55:45  joergs
205 # AmigaOS support added.
206 #
207 # Revision 1.24  2001/09/12 17:28:59  david__schmidt
208 #
209 # OS/2 port: update autoconf'd support for the platform.
210 #
211 # Revision 1.23  2001/09/12 16:28:42  swa
212 # added "make dok" section to generate html pages from
213 # the sgml source documents. note that the we do not want
214 # generated stuff in cvs.
215 #
216 # Revision 1.22  2001/09/10 16:31:23  swa
217 # buildroot definition in the specfile fucks up the build
218 # process under suse. hence I moved it to the "rpm -ta"
219 # command
220 #
221 # Revision 1.21  2001/09/10 11:12:49  oes
222 # Turning on -Wall
223 #
224 # Revision 1.20  2001/08/02 22:04:29  jongfoster
225 # Removing some remaining references to obsolete w32rulesdlg.[ch]
226 #
227 # Revision 1.19  2001/07/30 22:14:03  jongfoster
228 # Removing obsolete w32rulesdlg.c and w32rulesdlg.h
229 #
230 # Revision 1.18  2001/07/29 17:09:17  jongfoster
231 # Major changes to build system in order to fix these bugs:
232 # - pthreads under Linux was broken - changed -lpthread to -pthread
233 # - Compiling in MinGW32 mode under CygWin now correctly detects
234 #   which shared libraries are available
235 # - Solaris support (?) (Not tested under Solaris yet)
236 #
237 # Revision 1.17  2001/07/28 16:44:54  oes
238 # Fixed sed LF->CRLF conversion and removed deprecated files
239 #
240 # Revision 1.16  2001/07/15 19:45:33  jongfoster
241 # Added support for linking with POSIX threads library
242 #
243 # Revision 1.15  2001/07/13 13:48:07  oes
244 #  - Moved STATIC #define for pcre to (ac)config.h
245 #  - Made -Ipcre depandant on static pcre compilation to
246 #    avoid version conflicts
247 #  - Included compilation and depandancies for new deanimate.c
248 #  - Made changes to the pcre/pcreposix/pcrs build process
249 #    as required by the new library autodetection in
250 #    configure.in
251 #
252 # Revision 1.14  2001/07/01 16:27:44  oes
253 # Fixed misplaced dependancy
254 #
255 # Revision 1.13  2001/06/29 13:18:36  oes
256 # - added depandancy of filters.o on cgi.h
257 #
258 # Revision 1.12  2001/06/12 17:15:56  swa
259 # fixes, because a clean build on rh6.1 was impossible.
260 # GZIP confuses make, %configure confuses rpm, etc.
261 #
262 # Revision 1.11  2001/06/11 11:26:35  sarantis
263 # RPM version should be the same as ijbswa version.  The rpm release is
264 # specified in the specfile.
265 #
266 # Revision 1.10  2001/06/07 17:27:45  swa
267 # added suse build section
268 #
269 # Revision 1.9  2001/06/04 18:31:58  swa
270 # files are now prefixed with either `confdir' or `logdir'.
271 # `make redhat-dist' replaces both entries confdir and logdir
272 # with redhat values
273 #
274 # Revision 1.8  2001/06/04 10:44:57  swa
275 # `make redhatr-dist' now works. Except for the paths
276 # in the config file.
277 #
278 # Revision 1.7  2001/06/03 17:09:09  swa
279 # swa for oes: reversed my earlier change
280 #
281 # Revision 1.6  2001/06/03 17:07:27  swa
282 # swa for oes
283 #
284 # Revision 1.5  2001/06/03 13:57:26  swa
285 # compile cgi.c (for andreas' GUI)
286 #
287 # Revision 1.4  2001/05/31 21:18:45  jongfoster
288 # Added files actions.[ch], actionlist.h, list.[ch] to Makefile
289 #
290 # Revision 1.3  2001/05/29 20:02:48  joergs
291 # Changes for AmigaOS added.
292 #
293 # Revision 1.2  2001/05/17 22:23:23  oes
294 #  - Added auto-generation of CRLFs for Win32 config files
295 #  - Added comment-prefix to all Win32-only options in the config file
296 #    and provided auto stripping of this prefix for the Win32 platform by make
297 #
298 # Revision 1.1.1.1  2001/05/15 13:59:00  oes
299 # Initial import of version 2.9.3 source tree
300 #
301 #
302
303 #############################################################################
304 # Version number (for RPM)
305 #############################################################################
306
307 VERSION_MAJOR = @VERSION_MAJOR@
308 VERSION_MINOR = @VERSION_MINOR@
309 VERSION_POINT = @VERSION_POINT@
310 CODE_STATUS   = @CODE_STATUS@
311 VERSION       = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_POINT)
312 # will automatically be postfixed with -$(RPM_PACKAGEV) in the SPECfile
313 RPM_VERSION   = $(VERSION)
314 RPM_PACKAGEV  = 3
315
316
317 #############################################################################
318 # Directories for "make install"
319 #############################################################################
320
321 DEST        = @sysconfdir@/junkbuster
322 SBIN_DEST   = @sbindir@
323 MAN_DEST    = @mandir@
324
325
326 #############################################################################
327 # Build tools
328 #############################################################################
329
330 PROGRAM    = jbng@EXEEXT@
331 CC         = @CC@
332 ECHO       = echo
333 GZIP_PROG  = gzip
334 INSTALL    = cp -f
335 LD         = @CC@
336 RM         = rm -f
337 STRIP_PROG = strip
338 SED        = sed
339 CAT        = cat
340 RPM        = rpm
341 MV         = mv
342 TAR        = tar
343 MAKE       = make
344 LN         = ln
345 WDUMP      = @WDUMP@ -dump
346 JADEBIN    = @JADEBIN@
347 DB         = $(JADEBIN) -t sgml -ihtml -D.. -d ldpOK.dsl\#html
348 DB2HTML    = @DB2HTML@
349 DKPREFIX   = @DKPREFIX@
350
351 # Program to do LF->CRLF
352 #
353 # The sed version should be the most portable, but it doesn't for for me,
354 # the other two do.  FIXME.
355 #   - Jon
356 #DOSFILTER  = $(SED) -e $$'s,$$,\r,'
357 #DOSFILTER  = gawk -v ORS='\r\n' '{print $0;}'
358 DOSFILTER  = perl -p -e 's/\n/\r\n/'
359
360 #############################################################################
361 # Setup for make distribution rh and suse for now 
362 #############################################################################
363
364 TAR_ARCH = /tmp/JunkbusterNG-$(RPM_VERSION).tar.gz
365 RPM_BASE = @RPM_BASE@
366
367 #############################################################################
368 # Filenames and libraries
369 #############################################################################
370
371 C_SRC  = actions.c cgi.c cgiedit.c cgisimple.c deanimate.c encode.c \
372          errlog.c filters.c gateway.c jbsockets.c jcc.c killpopup.c \
373          list.c loadcfg.c loaders.c miscutil.c parsers.c ssplit.c \
374          urlmatch.c
375
376 C_OBJS = $(C_SRC:.c=.@OBJEXT@)
377 C_HDRS = $(C_SRC:.c=.h) project.h actionlist.h
378
379 W32_SRC   = @WIN_ONLY@w32log.c w32taskbar.c win32.c
380 W32_FILES = @WIN_ONLY@w32.res
381 W32_OBJS  = @WIN_ONLY@$(W32_SRC:.c=.@OBJEXT@) $(W32_FILES)
382 W32_HDRS  = @WIN_ONLY@w32log.h w32taskbar.h win32.h w32res.h
383 W32_LIB   = @WIN_ONLY@-lwsock32 -lcomctl32
384 W32_INIS  = @WIN_ONLY@config.txt trust.txt
385
386 PCRS_SRC     = @STATIC_PCRS_ONLY@pcrs.c
387 PCRS_OBJS    = @STATIC_PCRS_ONLY@$(PCRS_SRC:.c=.@OBJEXT@)
388 PCRS_HDRS    = @STATIC_PCRS_ONLY@$(PCRS_SRC:.c=.h)
389
390 PCRE_SRC     = @STATIC_PCRE_ONLY@pcre/get.c pcre/maketables.c pcre/study.c pcre/pcre.c
391 PCRE_OBJS    = @STATIC_PCRE_ONLY@$(PCRE_SRC:.c=.@OBJEXT@)
392 PCRE_HDRS    = @STATIC_PCRE_ONLY@pcre/config.h pcre/chartables.c pcre/internal.h pcre/pcre.h
393
394 # No REGEX (Either because dynamically linked pcreposix, or no regex at all):
395 REGEX_SRC    =
396 # GNU REGEX:
397 @GNU_REGEX_ONLY@REGEX_SRC    = gnu_regex.c
398 # PCRE REGEX:
399 @PCRE_REGEX_ONLY@@STATIC_PCRE_ONLY@REGEX_SRC = pcre/pcreposix.c
400
401 REGEX_OBJS   = $(REGEX_SRC:.c=.@OBJEXT@)
402 REGEX_HDRS   = $(REGEX_SRC:.c=.h)
403
404 # Dependencies introduced by #include "project.h".
405 PROJECT_H_DEPS = project.h $(REGEX_HDRS) $(PCRS_HDRS) @STATIC_PCRE_ONLY@pcre/pcre.h
406
407 # Socket libraries for platforms that need them explicitly defined
408 SOCKET_LIB   = @SOCKET_LIB@
409
410 # PThreads library, if needed.
411 PTHREAD_LIB  = @PTHREAD_ONLY@@PTHREAD_LIB@
412
413 SRCS         = $(C_SRC)  $(W32_SRC)  $(PCRS_SRC)  $(PCRE_SRC)  $(REGEX_SRC)
414 OBJS         = $(C_OBJS) $(W32_OBJS) $(PCRS_OBJS) $(PCRE_OBJS) $(REGEX_OBJS)
415 HDRS         = $(C_HDRS) $(W32_HDRS) $(PCRS_HDRS) $(PCRE_OBJS) $(REGEX_HDRS)
416 LIBS         = @LIBS@ $(W32_LIB) $(SOCKET_LIB) $(PTHREAD_LIB)
417
418
419 #############################################################################
420 # Compiler switches
421 #############################################################################
422
423 # The flag "-mno-win32" can be used by Cygwin to emulate a un?x type build.
424 # The flag "-mwindows -mno-cygwin" will cause Cygwin to use MingW32 for a
425 # Win32 GUI build.
426 # The flag "-pthread" is required if using Pthreads under Linux (and
427 # possibly other OSs).
428 SPECIAL_CFLAGS = @SPECIAL_CFLAGS@
429
430 # Add your flags here 
431 OTHER_CFLAGS =   
432
433 CFLAGS = @CFLAGS@ @CPPFLAGS@ $(OTHER_CFLAGS) $(SPECIAL_CFLAGS) -Wall \
434          @STATIC_PCRE_ONLY@ -Ipcre 
435
436 LDFLAGS = $(DEBUG_CFLAGS) $(SPECIAL_CFLAGS)
437
438
439 #############################################################################
440 # Build section.
441 #
442 # There should NOT be any targets above this line.
443 #############################################################################
444 all: $(PROGRAM)
445
446
447 #############################################################################
448 # Phony targets
449 #############################################################################
450 .PHONY: all inifiles redhat-dist redhat-upload solaris-dist suse-dist \
451 suse-upload win-dist tarball-dist dok redhat-dok webserver clean clobber tags \
452 install
453
454
455 #############################################################################
456 # Define this explicitly because Solaris is broken!
457 #############################################################################
458 %.o: %.c
459         $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
460
461
462 #############################################################################
463 # Win32 config files
464 #############################################################################
465
466 inifiles: $(W32_INIS)
467
468 config.txt: config
469         $(SED) -e 's!\trustfile trust!trustfile trust.txt!' \
470                -e 's!\jarfile jarfile!jarfile jar.log!' \
471                -e 's!\logfile logfile!logfile junkbuster.log!' \
472                -e 's!#Win32-only: !!' \
473                < $< | \
474                $(DOSFILTER) > $@
475         # LF to CRLF in default.action
476         $(DOSFILTER) <default.action >default.action.txt && mv default.action.txt default.action
477         # LF to CRLF in default.filter
478         $(DOSFILTER) <default.filter >default.filter.txt && mv default.filter.txt default.filter
479
480 trust.txt: trust
481         $(DOSFILTER) < $< > $@ 
482
483 re_filterfile.txt: re_filterfile
484         $(DOSFILTER) < $< > $@ 
485
486
487 #############################################################################
488 # redhat distribution alpha and x86
489 #############################################################################
490
491 redhat-dist:
492         for dir in RPMS SRPMS BUILD SOURCES SPECS; do \
493                 if [ ! -w $(RPM_BASE)/$$dir ]; then \
494                         $(ECHO) "$(RPM_BASE)/$$dir is not writable for you. Maybe try as root."; \
495                         $(ECHO) "Or add a suitable path to .rpmmacros like."; \
496                         $(ECHO) "%_topdir /home/foo/rpm-build"; \
497                         exit 1; \
498                 fi; \
499         done; \
500
501         $(MAKE) clobber
502         if [ -f $(TAR_ARCH) ]; then $(RM) $(TAR_ARCH); fi
503
504         TMPFILE=$$(mktemp -q /tmp/$(PROGRAM).XXXXXX); \
505         if $(SED) -e 's/^\(Version:\).*/\1 $(RPM_VERSION)/g' \
506              -e 's/^\(Release:\).*/\1 $(RPM_PACKAGEV)/g' \
507               junkbusterng-rh.spec > $$TMPFILE ; then \
508       $(MV) -f $$TMPFILE junkbusterng-rh.spec; \
509    else \
510       $(ECHO) "Could not set version info in specfile."; \
511       exit 1;\
512    fi
513
514         $(TAR) --exclude "CVS" --exclude "junkbuster-suse.spec" -czf $(TAR_ARCH) .
515         $(RPM) --clean -ta  $(TAR_ARCH)
516         if [ -f $(TAR_ARCH) ]; then  $(RM) $(TAR_ARCH); fi
517
518 #
519 # anonymously ncftps the rpms to sourceforge
520 #
521 redhat-upload:
522         ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming $(RPM_BASE)/SRPMS/junkbusterng-$(RPM_VERSION)-$(RPM_PACKAGEV).src.rpm
523 # better should use `arch` here instead of ix86 to support other platforms too
524         ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming $(RPM_BASE)/RPMS/*/junkbusterng-$(RPM_VERSION)-$(RPM_PACKAGEV).*.rpm
525         @$(ECHO) -------------------------------------------------------
526         @$(ECHO) Now goto
527         @$(ECHO) http://sourceforge.net/project/admin/editpackages.php?group_id=11118
528         @$(ECHO) ... and release the files.
529         @$(ECHO) -------------------------------------------------------
530      # w3m http://sourceforge.net/project/admin/editpackages.php?group_id=11118
531
532 #############################################################################
533 # sun solaris  distribution
534 #############################################################################
535 solaris-dist:
536         @$(ECHO) coming soon. 
537
538 #############################################################################
539 # suse distribution (need to be root to build)
540 #############################################################################
541
542 suse-dist:
543         for dir in RPMS SRPMS BUILD SOURCES SPECS; do \
544                 if [ ! -w $(RPM_BASE)/$$dir ]; then \
545                         $(ECHO) "$(RPM_BASE)/$$dir is not writable for you. Maybe try as root."; \
546                         $(ECHO) "Or add a suitable path to .rpmmacros like."; \
547                         $(ECHO) "%_topdir /home/foo/rpm-build"; \
548                         exit 1; \
549                 fi; \
550         done; \
551
552         $(MAKE) clobber
553         if [ -f $(TAR_ARCH) ]; then $(RM) $(TAR_ARCH); fi
554
555         TMPFILE=$$(mktemp -q /tmp/$(PROGRAM).XXXXXX); \
556         if $(SED) -e 's/^\(Version:\).*/\1 $(RPM_VERSION)/g' \
557              -e 's/^\(Release:\).*/\1 $(RPM_PACKAGEV)/g' \
558               junkbuster-suse.spec > $$TMPFILE ; then \
559       $(MV) -f $$TMPFILE junkbuster-suse.spec; \
560    else \
561       $(ECHO) "Could not set version info in specfile."; \
562       exit 1;\
563    fi
564
565         $(TAR) --exclude "CVS" --exclude "junkbuster-rh.spec" -czf $(TAR_ARCH) .
566         $(RPM) --clean -ta  $(TAR_ARCH)
567         if [ -f $(TAR_ARCH) ]; then  $(RM) $(TAR_ARCH); fi
568
569 #
570 # anonymously ncftps the rpms to sourceforge
571 #
572 suse-upload:
573         ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming $(RPM_BASE)/SRPMS/junkbuster-suse-$(RPM_VERSION)-$(RPM_PACKAGEV).src.rpm
574 # better should use `arch` here instead of ix86 to support other platforms too
575         ncftpput -u anonymous -p ijbswa-developers@lists.sourceforge.net upload.sourceforge.net /incoming $(RPM_BASE)/RPMS/*/junkbuster-suse-$(RPM_VERSION)-$(RPM_PACKAGEV).*.rpm
576         @$(ECHO) -------------------------------------------------------
577         @$(ECHO) Now goto
578         @$(ECHO) http://sourceforge.net/project/admin/editpackages.php?group_id=11118
579         @$(ECHO) ... and release the files.
580         @$(ECHO) -------------------------------------------------------
581
582 # handle with care. use with root.
583 suse-clean:
584         rpm -e junkbuster-suse
585         rm -rf /etc/junkbuster
586         rm -rf /etc/rc.d/junkbuster*
587         rm -rf /var/run/junkbuster.pid 
588         rm -rf /var/log/junkbuster
589         rm -f /etc/init.d/junkbuster
590         rm -f /usr/sbin/junkbuster
591         rm -f /usr/sbin/rcjunkbuster
592         rm -f /usr/share/man/man1/junkbuster.1.gz
593
594 #############################################################################
595 # Windows distribution
596 #############################################################################
597 win-dist:
598         $(ECHO) Not implemented.
599
600
601 #############################################################################
602 # Tarball distribution
603 #############################################################################
604 tarball-dist:
605         @make clean
606         make $(PROGRAM) 
607 #       remove all objects and create the tarball with the binary
608         cd .. && $(RM) ijb/a.out ijb/core ijb/*.@OBJEXT@ && tar --exclude "ijb/CVS" -cvzf ../JunkbusterNG-distribution-$(VERSION).tar.gz ijb/
609         chmod a+r ../../JunkbusterNG-distribution-$(VERSION).tar.gz
610         @$(ECHO) Tarball with binary created.
611
612 #############################################################################
613 #
614 # Documentation
615 #
616 # converts doc/source/*.sgml into html, text and man pages
617 #
618 #############################################################################
619 dok: doc/source/ldpOK.dsl
620         mkdir -p doc/text doc/man
621 #  user manual
622         rm -rf doc/webserver/user-manual
623         cd doc/source && $(DB2HTML) -s ldpOK.dsl user-manual.sgml && mv user-manual ../webserver
624         cd doc/source && $(DB2HTML) -s ldpOK.dsl --nochunks user-manual.sgml > tmp.html && lynx -dump tmp.html > ../text/user-manual.txt && rm -rf tmp.html user-manual
625 ##  developer manual
626         rm -rf doc/webserver/developer-manual
627         cd doc/source && $(DB2HTML) -s ldpOK.dsl developer-manual.sgml && mv developer-manual ../webserver
628         cd doc/source && $(DB2HTML) -s ldpOK.dsl --nochunks developer-manual.sgml > tmp.html && lynx -dump tmp.html > ../text/developer-manual.txt && rm -rf tmp.html developer-manual
629 ##  faq
630         rm -rf doc/webserver/faq
631         cd doc/source && $(DB2HTML) -s ldpOK.dsl faq.sgml && mv faq ../webserver
632         cd doc/source && $(DB2HTML) -s ldpOK.dsl --nochunks faq.sgml > tmp.html && lynx -dump tmp.html > ../text/faq.txt && rm -rf tmp.html faq
633
634 redhat-dok: doc/source/ldpOK.dsl
635         mkdir -p doc/text doc/man doc/source/user-manual \
636           doc/source/developer-manual doc/source/faq
637 ##  user manual
638         rm -rf doc/webserver/user-manual
639         cd doc/source/user-manual && $(DB) ../user-manual.sgml && cd .. &&\
640           mv user-manual ../webserver
641         cd doc/source && $(DB) -V nochunks user-manual.sgml > tmp.html && \
642           $(WDUMP) tmp.html > ../text/user-manual.txt && rm -rf tmp.html \
643           user-manual
644 ##  developer manual
645         rm -rf doc/webserver/developer-manual
646         cd doc/source/developer-manual && $(DB) ../developer-manual.sgml &&\
647           cd .. && mv developer-manual ../webserver
648         cd doc/source && $(DB) -V nochunks developer-manual.sgml > tmp.html && \
649           $(WDUMP) tmp.html > ../text/developer-manual.txt && rm -rf tmp.html \
650           developer-manual
651 ##  faq
652         rm -rf doc/webserver/faq
653         cd doc/source/faq && $(DB) ../faq.sgml && cd .. && mv faq ../webserver
654         cd doc/source && $(DB) -V nochunks faq.sgml > tmp.html && $(WDUMP) \
655           tmp.html > ../text/faq.txt && rm -rf tmp.html faq
656
657 doc/source/ldpOK.dsl:
658         if [ "$(DKPREFIX)" != "none" ]; then \
659                 sed -e "s@/usr/share/sgml/docbook/dsssl-stylesheets@$(DKPREFIX)@g" doc/source/ldp.dsl > doc/source/ldpOK.dsl; \
660         else \
661                 cp doc/source/ldp.dsl doc/source/ldpOK.dsl; \
662         fi
663
664 #############################################################################
665 #
666 # Webserver
667 #
668 # moves dokumentation to webserver
669 #
670 #############################################################################
671 webserver:
672         @$(ECHO) -------------------------------------------------------
673         @$(ECHO) You have run make dok/redhat-dok before, right?
674         @$(ECHO) Note that this command scps all stuff to the webserver,
675         @$(ECHO) it will not remove obsolete documents.
676         @$(ECHO) -------------------------------------------------------
677         chmod -R a+r doc/webserver
678         find doc/webserver -type d -exec chmod a+rx {} \;
679         cd doc/webserver && scp -Cr . ijbswa.sourceforge.net:/home/groups/i/ij/ijbswa/htdocs/
680
681 #############################################################################
682 # Source file dependencies
683 #############################################################################
684
685 actions.@OBJEXT@:   actions.c   actions.h   config.h $(PROJECT_H_DEPS) errlog.h jcc.h list.h loaders.h miscutil.h actionlist.h
686 cgi.@OBJEXT@:       cgi.c       cgi.h       config.h $(PROJECT_H_DEPS) cgiedit.h cgisimple.h list.h pcrs.h encode.h ssplit.h jcc.h filters.h actions.h errlog.h miscutil.h
687 cgiedit.@OBJEXT@:   cgiedit.c   cgiedit.h   config.h $(PROJECT_H_DEPS) cgi.h list.h pcrs.h encode.h ssplit.h jcc.h filters.h actions.h errlog.h miscutil.h
688 cgisimple.@OBJEXT@: cgisimple.c cgisimple.h config.h $(PROJECT_H_DEPS) cgi.h list.h pcrs.h encode.h ssplit.h jcc.h filters.h actions.h errlog.h miscutil.h
689 deanimate.@OBJEXT@: deanimate.c deanimate.h config.h $(PROJECT_H_DEPS)
690 encode.@OBJEXT@:    encode.c    encode.h    config.h
691 errlog.@OBJEXT@:    errlog.c    errlog.h    config.h $(PROJECT_H_DEPS) @WIN_ONLY@w32log.h
692 filters.@OBJEXT@:   filters.c   filters.h   config.h $(PROJECT_H_DEPS) errlog.h encode.h gateway.h jbsockets.h jcc.h loadcfg.h parsers.h ssplit.h cgi.h deanimate.h @WIN_ONLY@win32.h 
693 gateway.@OBJEXT@:   gateway.c   gateway.h   config.h $(PROJECT_H_DEPS) errlog.h jbsockets.h jcc.h loadcfg.h
694 jbsockets.@OBJEXT@: jbsockets.c jbsockets.h config.h $(PROJECT_H_DEPS) filters.h
695 jcc.@OBJEXT@:       jcc.c       jcc.h       config.h $(PROJECT_H_DEPS) errlog.h filters.h gateway.h jbsockets.h killpopup.h loadcfg.h loaders.h miscutil.h parsers.h @WIN_ONLY@w32log.h win32.h cgi.h
696 killpopup.@OBJEXT@: killpopup.c killpopup.h config.h $(PROJECT_H_DEPS) jcc.h loadcfg.h
697 list.@OBJEXT@:      list.c      list.h      config.h $(PROJECT_H_DEPS) list.h miscutil.h
698 loadcfg.@OBJEXT@:   loadcfg.c   loadcfg.h   config.h $(PROJECT_H_DEPS) errlog.h filters.h gateway.h jbsockets.h jcc.h killpopup.h loaders.h miscutil.h parsers.h @WIN_ONLY@w32log.h win32.h
699 loaders.@OBJEXT@:   loaders.c   loaders.h   config.h $(PROJECT_H_DEPS) errlog.h encode.h filters.h gateway.h jcc.h loadcfg.h miscutil.h parsers.h ssplit.h
700 miscutil.@OBJEXT@:  miscutil.c  miscutil.h  config.h
701 parsers.@OBJEXT@:   parsers.c   parsers.h   config.h $(PROJECT_H_DEPS) errlog.h encode.h filters.h jbsockets.h jcc.h loadcfg.h loaders.h miscutil.h ssplit.h
702 ssplit.@OBJEXT@:    ssplit.c    ssplit.h    config.h miscutil.h
703 urlmatch.@OBJEXT@:  urlmatch.c  urlmatch.h  config.h $(PROJECT_H_DEPS) errlog.h miscutil.h ssplit.h
704
705 # GNU regex
706 gnu_regex.@OBJEXT@: gnu_regex.c gnu_regex.h config.h
707
708 # PCRS
709 pcrs.@OBJEXT@: pcrs.c pcre/pcre.h pcrs.h
710
711 # PCRE
712 pcre/get.@OBJEXT@:        pcre/get.c        pcre/config.h pcre/internal.h pcre/pcre.h
713 pcre/maketables.@OBJEXT@: pcre/maketables.c pcre/config.h pcre/internal.h pcre/pcre.h
714 pcre/pcre.@OBJEXT@:       pcre/pcre.c       pcre/config.h pcre/internal.h pcre/pcre.h pcre/chartables.c 
715 pcre/pcreposix.@OBJEXT@:  pcre/pcreposix.c  pcre/config.h pcre/internal.h pcre/pcre.h pcre/pcreposix.h
716 pcre/study.@OBJEXT@:      pcre/study.c      pcre/config.h pcre/internal.h pcre/pcre.h
717
718 # An auxiliary program makes the PCRE default character table source
719
720 pcre/chartables.c:   pcre/dftables@EXEEXT@
721                 pcre/dftables@EXEEXT@ >pcre/chartables.c
722
723 pcre/dftables@EXEEXT@:       pcre/dftables.c pcre/maketables.c pcre/pcre.h pcre/internal.h pcre/config.h
724                 $(CC) -o pcre/dftables@EXEEXT@ $(CFLAGS) pcre/dftables.c
725
726 # Win32
727 w32log.@OBJEXT@: w32log.c errlog.h config.h jcc.h loadcfg.h miscutil.h pcre/pcre.h pcre/pcreposix.h pcrs.h project.h w32log.h w32taskbar.h win32.h
728 w32taskbar.@OBJEXT@: w32taskbar.c config.h w32log.h w32taskbar.h
729 win32.@OBJEXT@: win32.c config.h jcc.h loadcfg.h pcre/pcre.h pcre/pcreposix.h pcrs.h project.h w32log.h win32.h
730
731 w32.res: w32.rc w32res.h icons/ico00001.ico icons/ico00002.ico icons/ico00003.ico icons/ico00004.ico icons/ico00005.ico icons/ico00006.ico icons/ico00007.ico icons/ico00008.ico icons/idle.ico icons/junkbust.ico config.h
732         windres -D__MINGW32__=0.2 -O coff -i $< -o $@
733
734 # AmigaOS
735 @AMIGAOS_ONLY@OBJS += amiga.o
736 @AMIGAOS_ONLY@CFLAGS += -D__AMIGAVERSION__=\"$(VERSION_MAJOR).$(VERSION_MINOR)$(VERSION_POINT)\" -D__AMIGADATE__=\"`date +%d.%m.%Y`\" -W -m68020 -noixemul -fbaserel -msmall-code
737 @AMIGAOS_ONLY@LDFLAGS += -m68020 -noixemul -fbaserel
738 @AMIGAOS_ONLY@LIBS = -lm /gg/lib/libb/libm020/libnix/swapstack.o
739 @AMIGAOS_ONLY@amiga.o: amiga.c amiga.h config.h
740
741
742 $(PROGRAM): $(OBJS) $(W32_FILES)
743         $(LD) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS)
744
745 clean:
746         $(RM) a.out core $(OBJS) $(W32_FILES) $(W32_INIS)
747
748 clobber: clean
749         $(RM) $(PROGRAM) cscope.* logfile *.pdb *.lib *.exp `find . -name tags` TAGS junkbuster.log config.cache *~ *.tar.gz
750
751 tags: $(SRCS) $(HDRS)
752         etags $(SRCS) $(HDRS)
753
754 tarball-src: clobber
755         $(LN) -s current ../JunkbusterNG-$(VERSION)-$(CODE_STATUS)
756         $(TAR) -C.. -cvhzf JunkbusterNG-$(VERSION)-$(CODE_STATUS)-src.tar.gz JunkbusterNG-$(VERSION)-$(CODE_STATUS)
757         $(RM) ../JunkbusterNG-$(VERSION)-$(CODE_STATUS)
758
759 install: all
760         #
761         # FIXME: This is a dirty hack to have an install target
762         #        that works at least for some setups. This needs
763         #        to be fixed!
764         #
765         $(STRIP_PROG) $(PROGRAM)
766         $(INSTALL) $(PROGRAM) $(SBIN_DEST)
767         mkdir -p $(DEST)/user-manual
768         mkdir -p $(DEST)/templates
769         cp -r doc/webserver/user-manual $(DEST)
770         cp -r templates $(DEST)
771         $(INSTALL) config default.action default.filter trust $(DEST)
772         # FIXME $(ECHO) junkbuster.logrotate junkbuster.monthly junkbuster.weekly
773         # FIXME: Need new manual! $(GZIP_PROG) -c junkbuster.1 > $(MAN_DEST)/junkbuster.1.gz
774         $(INSTALL) junkbusterng.init /etc/init.d/junkbusterng
775
776
777 #############################################################################
778
779 ## Local Variables:
780 ## tab-width: 3
781 ## end: