summaryrefslogtreecommitdiffstatsabout
path: root/Makefile
blob: d2effa0c127ff20b5317ad0c294e3d04684368d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# $Id: Makefile,v 1.17 2002/11/27 07:13:58 helios Exp $

###########################################################################
# Important:
# Adjust these values as outlined in section "Installation" in the docs.
# Not all are needed at all times.

APACHESOURCE = /usr/local/src/apache_1.3.27-dso
APACHEINST   = /usr/local/Apache
APXS         = $(APACHEINST)/bin/apxs

MYSQLLIBS  = /usr/lib
MYSQLHDRS  = /usr/include/mysql

#MODSSLHDRS = /usr/local/src/apache_1.3.27-dso/src/modules/ssl
DB1HDRS    = /usr/include/db1

###########################################################################
# Don't uncomment this without reading the "Optimizing for a busy database"
# section in the documentation (under "Advanced logging scenarios").

MYSQLDELAYED = -DWANT_DELAYED_MYSQL_INSERT

###########################################################################
# Rarely if ever have to touch below here.

MLMVERS  = 1.18
#APXSGDB  = -Wc,-g
APXSOPTS = -Wc,-O2 -Wc,-Wall
STATOPTS = -fpic -O2 -Wall
CC       = gcc
INSTALL  = /usr/bin/install -m 664
RM       = /bin/rm
LYX      = /usr/bin/lyx
LATEX    = /usr/bin/latex
DVIPS    = /usr/bin/dvips
LINKS    = /usr/bin/links
L2H      = /usr/local/bin/latex2html
WEBSERV  = gw0.corp

STATFLAGS = -I$(APACHEINST)/include
SOFLAGS   = -L$(MYSQLLIBS) -lmysqlclient -lz
ifdef MODSSLHDRS
   FLAGS     = -DEAPI -I$(MYSQLHDRS) $(MYSQLDELAYED) -I$(MODSSLHDRS) -I$(DB1HDRS) -DWANT_SSL_LOGGING
else
   FLAGS     = -DEAPI -I$(MYSQLHDRS) $(MYSQLDELAYED)
endif

all:
	@echo "You can choose to make mod_log_sql as a static or dynamic module."
	@echo "Either 'make dso' or 'make static'."
	@echo
	@echo "Please first read the documentation carefully!"

dso: mod_log_sql.so

static: mod_log_sql.o

mod_log_sql.so: mod_log_sql.c Makefile
	$(APXS) -c $(APXSGDB) $(APXSOPTS) $(FLAGS) $(SOFLAGS) mod_log_sql.c

mod_log_sql.o:	mod_log_sql.c Makefile
	$(CC) $(STATOPTS) $(FLAGS) $(STATFLAGS) -c mod_log_sql.c

dsoinstall: dso
	$(APXS) -i mod_log_sql.so

statinstall: static
	$(INSTALL) -d -m 755 $(APACHESOURCE)/src/modules/sql
	$(INSTALL) mod_log_sql.c $(APACHESOURCE)/src/modules/sql/mod_log_sql.c
	$(INSTALL) Makefile $(APACHESOURCE)/src/modules/sql/Makefile
	$(INSTALL) mod_log_sql.o $(APACHESOURCE)/src/modules/sql/mod_log_sql.o

clean:
	$(RM) -rf *.o *.so
	$(RM) -f Documentation/HTML/*.html Documentation/HTML/*.css Documentation/HTML/*.png
	$(RM) -f Documentation/*.tex
	$(RM) -f Documentation/*.dvi
	$(RM) -f Documentation/*.ps
	$(RM) -f Documentation/*.txt

distro: documentation
	@scp CHANGELOG $(WEBSERV):$(APACHEINST)/html/mod_log_sql/docs
	@scp Documentation/*.ps $(WEBSERV):$(APACHEINST)/html/mod_log_sql/docs
	@scp Documentation/HTML/*.html $(WEBSERV):$(APACHEINST)/html/mod_log_sql/docs/
	@scp Documentation/HTML/*.png $(WEBSERV):$(APACHEINST)/html/mod_log_sql/docs/
	@cd ..; tar zcf mod_log_sql-$(MLMVERS).tar.gz --exclude mod_log_sql/CVS --exclude mod_log_sql/Documentation/CVS --exclude mod_log_sql/Documentation/HTML/CVS --exclude ".directory" mod_log_sql/; scp mod_log_sql-$(MLMVERS).tar.gz $(WEBSERV):$(APACHEINST)/html/mod_log_sql/; rm -f mod_log_sql-$(MLMVERS).tar.gz
	@ssh $(WEBSERV) "ln -sf mod_log_sql-$(MLMVERS).tar.gz $(APACHEINST)/html/mod_log_sql/mod_log_sql.tar.gz"

documentation: Documentation/documentation.lyx
	@echo "Creating LaTeX docs..."
	@$(LYX) --export latex Documentation/documentation.lyx 2>/dev/null
	@echo "Creating cross-references...run 1"
	@cd Documentation ; $(LATEX) documentation.tex >/dev/null 2>&1
	@echo "Creating cross-references...run 2"
	@cd Documentation ; $(LATEX) documentation.tex >/dev/null 2>&1
	@echo "Creating cross-references...run 3"
	@cd Documentation ; $(LATEX) documentation.tex >/dev/null 2>&1
	@echo "Creating PostScript docs..."
	@$(DVIPS) Documentation/documentation.dvi -o Documentation/documentation.ps 2>/dev/null
	@echo "Creating HTML docs..."
	@$(L2H) -local_icons -show_section_numbers -split 4 -navigation -noindex_in_navigation -contents_in_navigation -dir Documentation/HTML Documentation/documentation.tex >/dev/null 2>&1
	@echo "Creating plain text docs..."
	@$(L2H) -show_section_numbers -split 0 -dir Documentation/ Documentation/documentation.tex >/dev/null 2>&1
	@$(LINKS) -dump Documentation/documentation.html > Documentation/documentation.txt 2>/dev/null
	@echo "Cleaning up..."
	@$(RM) -f Documentation/*.html Documentation/WARNINGS Documentation/*.pl Documentation/*.aux Documentation/*.css Documentation/*.toc Documentation/*.log Documentation/*.old Documentation/*.png Documentation/images.tex
	@$(RM) -f Documentation/HTML/WARNINGS Documentation/HTML/*.pl Documentation/HTML/*.log Documentation/HTML/*.aux Documentation/HTML/*.tex Documentation/HTML/*.old Documentation/HTML/index.html