OSDN Git Service

Initial import.
[opengate/opengate.git] / opengate / opengatesrv / Makefile
1 ##################### Change following ###################
2 ##  must be matched to descriptions in html files ######## 
3 ##  some other parameters exist in opengatesrv.h  ########
4
5 # Change HOSTADDR to your gateway client side IP address#
6 #########################################################
7 HOSTADDR = 192.168.29.138
8
9 ### first web access directory top entered by forwarding
10 # top dir (must be *NonSSL* page top)
11 HTMLTOP1 = /usr/local/www/data
12
13 ### subsequent web access directory and files
14 # top dir (can be SSL page top)
15 HTMLTOP2 = /usr/local/www/data
16
17 # opengate documents directory relative to HTMLTOP2 
18 OPENGATEDIR = /opengate
19
20 ### opengate cgi program
21 CGIPATH = /usr/local/www/cgi-bin${OPENGATEDIR}
22 CGIPROG = opengatesrv.cgi
23
24 ### opengatesrv configuration file(copied from ../conf/opengatesrv.conf)
25 CONFIGFILE = /etc/opengatesrv.conf
26
27 ### use perl script(=1) to add firewall rule or execl ipfw directly(=0)
28 # 1 is for flexible control and 0 is for simple control(full open).
29 USEFWSCRIPT=1
30 ### firewall control perl script (copied from ../conf/opengatefw.pl)
31 FWSCRIPT = opengatefw.pl
32 FWSCRIPTPATH = /etc/${FWSCRIPT}
33
34 ### lockfile for ipfw exclusive exec
35 LOCKFILE=/tmp/opengate.lock
36
37 ### htmldocs and the languages (first one is the default language)
38 # store documents in each language directory under OPENGATEDIR
39 HTMLDOCS=topindex.html index.html index-ssl.html accept.html accept2.html deny.html
40 DENYDOC = deny.html            
41 ACCEPTDOC = accept.html        
42 HTMLLANGS=ja en
43
44 # path to arp command 
45 ARPPATH=/usr/sbin/arp
46 # path to ipfw command 
47 IPFWPATH=/sbin/ipfw
48 ##########################################################      
49
50 OGPATH=${HTMLTOP2}${OPENGATEDIR}
51
52 CFLAGS=-DCONFIGFILE=\"${CONFIGFILE}\" \
53        -DOPENGATEDIR=\"${OPENGATEDIR}\" \
54        -DDENYDOC=\"${DENYDOC}\" \
55        -DOGPATH=\"${OGPATH}\" \
56        -DACCEPTDOC=\"${ACCEPTDOC}\" \
57        -DIPFWPATH=\"${IPFWPATH}\" \
58        -DFWSCRIPTPATH=\"${FWSCRIPTPATH}\" \
59        -DFWSCRIPT=\"${FWSCRIPT}\" \
60        -DLOCKFILE=\"${LOCKFILE}\" \
61        -DUSEFWSCRIPT=${USEFWSCRIPT} \
62        -DARPPATH=\"${ARPPATH}\" \
63        -DHTMLLANGS="\"${HTMLLANGS}\""
64
65 LIBS = -lssl -lcrypto -lradius -lpam
66 OBJS = main.o utilities.o comm-auth.o comm-cgi.o comm-java.o comm-ipfw.o comm-arp.o error.o tcp_connect.o sock_ntop_host.o wrapper.o signal.o auth-pam.o auth-rad.o auth-pop3s.o comm-userdb.c
67 HDRS = opengatesrv.h
68 PROG =  opengatesrv
69 CLEANFILES = *.o *~
70
71 all:    ${PROG}
72
73 opengatesrv:    ${OBJS}
74                 ${CC} ${CFLAGS} -o $@ ${OBJS}  ${LIBS}
75
76 clean:
77                 rm -f ${PROG} ${CLEANFILES}
78
79 install:        install-cgi install-java install-html install-conf install-fwscript
80
81
82 install-cgi:    ${PROG}
83                 ## Copy CGI program and Set S bit ##
84 .if !exists(${CGIPATH})
85                 mkdir ${CGIPATH}
86 .endif
87                 cp ${PROG} ${CGIPATH}/${CGIPROG}
88                 chmod 4755  ${CGIPATH}/${CGIPROG}
89                 #
90
91
92 install-java:   
93                 ## Copy JAVA program ##
94 .if !exists(${OGPATH})
95                 mkdir ${OGPATH}
96 .endif
97                 cp  ../javahtml/*.class ${OGPATH}
98                 cp  ../javahtml/*.jar ${OGPATH}
99                 #
100
101
102 install-html:
103                 ## Copy HTML documents and insert addresses ##
104 .if exists(${HTMLTOP1}/index.html)
105                 mv ${HTMLTOP1}/index.html ${HTMLTOP1}/index.html.original
106 .endif
107 .for LANG in ${HTMLLANGS}
108 .if exists(../javahtml/${LANG})
109 .if !exists(${OGPATH}/${LANG})
110                 mkdir ${OGPATH}/${LANG}
111 .endif
112 .for DOC in ${HTMLDOCS}
113 .if exists(../javahtml/${LANG}/${DOC})
114                 sed -e 's/%%HOSTADDR%%/${HOSTADDR}/g' \
115                  -e 's!%%OPENGATEDIR%%!${OPENGATEDIR}!g' \
116                 <../javahtml/${LANG}/${DOC} >${OGPATH}/${LANG}/${DOC}
117 .endif
118 .endfor
119                 mv ${OGPATH}/${LANG}/topindex.html ${HTMLTOP1}/index.html.${LANG}
120 .endif
121 .endfor
122
123
124 install-conf:
125                 ## Copy CGI program ##
126                 cp  ../conf/opengatesrv.conf ${CONFIGFILE}
127                 #
128
129
130 install-fwscript:
131                 ## Copy firewall control script
132 .if ${USEFWSCRIPT}
133                 cp ../conf/${FWSCRIPT}  ${FWSCRIPTPATH}
134 .endif
135                 #
136
137
138 main.o:         ${HDRS}
139
140 utilities.o:    ${HDRS}
141
142 comm-auth.o:    ${HDRS}
143
144 comm-ipfw.o:    ${HDRS}
145
146 comm-cgi.o:     ${HDRS}
147
148 comm-java.o:    ${HDRS}
149
150 comm-arp.o:     ${HDRS}
151
152 comm-userdb.o:  ${HDRS}
153
154 auth-pam.o:     ${HDRS}
155
156 auth-rad.o:     ${HDRS}
157
158 auth-pop3s.o:   ${HDRS}