OSDN Git Service

48099c28462dfb9808f4e133198acf09b4760baa
[opengatem/opengatem.git] / mngsrc / Makefile
1 ################ Change following ########################
2 ##  some other parameters exist in opengatemmng.h  ########
3 ##########################################################
4 CONFIGPATH = /etc/opengate        ## directory of config file
5 WWWTOP = /usr/local/www/apache24  ## apache directory top(absolute path)
6 DOCDIR = /data                    ## apache data directory(relative path to wwwtop)
7 CGIDIR = /cgi-bin                 ## apache cgi directory(relative path to wwtop)
8 OPENGATEDIR = /opengate           ## opengate web directory(relative path to docdir)
9
10 DOCUMENTROOT = ${WWWTOP}${DOCDIR}
11 INSTALLDOCPATH = ${WWWTOP}${DOCDIR}${OPENGATEDIR}
12 INSTALLCGIPATH = ${WWWTOP}${CGIDIR}${OPENGATEDIR}
13 INSTALLBINPATH = /usr/local/bin   ## install dir of executable file
14 MAKEDIR != pwd                  ## save present working directory of MAKE
15
16 .if exists(/usr/local/include/mysql)
17 CFLAGSMYSQL = -I/usr/local/include/mysql -pipe -fno-strict-aliasing
18 LIBMYSQL = -L/usr/local/lib/mysql -lmysqlclient  -pthread -lz -lm
19 .endif
20
21 .if exists(/usr/local/include/sqlite3.h)
22 LIBSQLITE = -lsqlite3 -lpthread
23 .endif
24
25 .if exists(/usr/local/include/ldap.h)
26 LIBLDAP = -lldap -llber
27 .endif
28
29 #LIBCCMALLOC = -lccmalloc -L/usr/local/lib  ## memory leak check tool for debugging
30
31 CFLAGS= -g -O3 -Wall -I/usr/local/include ${CFLAGSMYSQL}
32
33 LIBS = -lezxml -lssl -lcrypto -lradius -lpam -L../ezxml -L/usr/local/lib ${LIBLDAP} ${LIBSQLITE} ${LIBMYSQL} ${LIBCCMALLOC}
34
35 OBJS = util.o error.o getparam.o managementdb.o workdb.c getmac.o cgi.o messages.o queue.o ipfw.o proc.o auth.o auth-pam.o auth-ftps.o auth-pop3s.o auth-rad.o auth-ldap.o alarms.o udpcli.o
36 HDRS = opengatemmng.h
37
38 CHKPROGO = opengatemchk.o
39 CHKPROG = opengatemchk
40 REGPROGO = opengatemreg.o
41 REGPROG = opengatemreg
42 UPPROGO = opengatemup.o
43 UPPROG = opengatemup
44 MAILPROGO = opengatemmail.o
45 MAILPROG = opengatemmail
46 OWNPROGO = opengatemown.o
47 OWNPROG = opengatemown
48 FWDPROGO = opengatemfwd.o
49 FWDPROG = opengatemfwd
50
51 LIBOPT = ezxml
52
53 CLEANFILES = *.o *~ *.core a.out \\#*
54
55 all:            ${CHKPROG} ${REGPROG} ${UPPROG} ${OWNPROG} ${MAILPROG} ${FWDPROG} ${LIBOPT}
56
57 opengatemchk:   ${OBJS} ${CHKPROGO} ${LIBOPT}
58                 ${CC} ${CFLAGS} -o $@ ${OBJS} ${CHKPROGO} ${LIBS}
59
60 opengatemreg:   ${OBJS} ${REGPROGO} ${LIBOPT}
61                 ${CC} ${CFLAGS} -o $@ ${OBJS} ${REGPROGO} ${LIBS}
62
63 opengatemup:    ${OBJS} ${UPPROGO} ${LIBOPT}
64                 ${CC} ${CFLAGS} -o $@ ${OBJS} ${UPPROGO} ${LIBS}
65
66 opengatemmail:  ${OBJS} ${MAILPROGO} ${LIBOPT}
67                 ${CC} ${CFLAGS} -o $@ ${OBJS} ${MAILPROGO} ${LIBS}
68
69 opengatemown:   ${OBJS} ${OWNPROGO} ${LIBOPT}
70                 ${CC} ${CFLAGS} -o $@ ${OBJS} ${OWNPROGO} ${LIBS}
71
72 opengatemfwd:   ${OBJS} ${FWDPROGO} ${LIBOPT}
73                 ${CC} ${CFLAGS} -o $@ ${OBJS} ${FWDPROGO} ${LIBS}
74
75 ezxml:  
76                 ${MAKE} -C ../ezxml
77
78 clean:
79                 rm -f ${CHKPROG} ${REGPROG} ${UPPROG} ${OWNPROG} ${FWDPROG} ${MAILPROG} ${CLEANFILES}
80                 ${MAKE} clean -C ../ezxml
81                 rm -f ../*/*~  ../*~ ../*/*/*~
82
83 # install mac registration and upating systems
84 install:        install-chkcgi install-regcgi install-upcgi install-owncgi install-fwdcgi install-mailbin install-conf install-html
85
86 #install only mac registration system
87 installmreg:    install-chkcgi install-regcgi install-conf install-html
88
89 #install only mac updating system
90 installmup:     install-upcgi install-mailbin install-conf install-html
91
92 #install only mac reg/update by owner oneself
93 installmown:    install-owncgi install-fwdcgi install-mailbin install-conf install-html
94
95 install-chkcgi: ${CHKPROG}
96                 ## Copy CGI program and Set S bit ##
97 .if !exists(${INSTALLCGIPATH})
98                 mkdir ${INSTALLCGIPATH}
99 .endif
100                 cp ${CHKPROG} ${INSTALLCGIPATH}/${CHKPROG}.cgi
101                 chmod 4755 ${INSTALLCGIPATH}/${CHKPROG}.cgi
102
103 install-regcgi: ${REGPROG}
104                 ## Copy CGI program and Set S bit ##
105 .if !exists(${INSTALLCGIPATH})
106                 mkdir ${INSTALLCGIPATH}
107 .endif
108                 cp ${REGPROG} ${INSTALLCGIPATH}/${REGPROG}.cgi
109                 chmod 4755 ${INSTALLCGIPATH}/${REGPROG}.cgi
110
111 install-upcgi:  ${UPPROG}
112                 ## Copy CGI program and Set S bit ##
113 .if !exists(${INSTALLCGIPATH})
114                 mkdir ${INSTALLCGIPATH}
115 .endif
116                 cp ${UPPROG} ${INSTALLCGIPATH}/${UPPROG}.cgi
117                 chmod 4755 ${INSTALLCGIPATH}/${UPPROG}.cgi
118
119 install-owncgi: ${OWNPROG}
120                 ## Copy CGI program and Set S bit ##
121 .if !exists(${INSTALLCGIPATH})
122                 mkdir ${INSTALLCGIPATH}
123 .endif
124                 cp ${OWNPROG} ${INSTALLCGIPATH}/${OWNPROG}.cgi
125                 chmod 4755 ${INSTALLCGIPATH}/${OWNPROG}.cgi
126
127 install-fwdcgi: ${FWDPROG}
128                 ## Copy CGI program and Set S bit ##
129 .if !exists(${INSTALLCGIPATH})
130                 mkdir ${INSTALLCGIPATH}
131 .endif
132                 cp ${FWDPROG} ${INSTALLCGIPATH}/${FWDPROG}.cgi
133                 chmod 4755 ${INSTALLCGIPATH}/${FWDPROG}.cgi
134
135 install-mailbin:        ${MAILPROG}
136 .if !exists(${INSTALLBINPATH})
137                 mkdir ${INSTALLBINPATH}
138 .endif
139                 cp ${MAILPROG} ${INSTALLBINPATH}/${MAILPROG}
140                 chmod 4755 ${INSTALLBINPATH}/${MAILPROG}
141
142 install-html:
143                 ## Copy HTML documents and etc ##
144 .if !exists(${INSTALLDOCPATH})
145                 mkdir ${INSTALLDOCPATH}
146 .endif
147                 cp -R ../html/* ${INSTALLDOCPATH}
148                 mv ${INSTALLDOCPATH}/index.html.var ${DOCUMENTROOT}/index.html.var.opengatem
149
150 install-conf:
151                 ## Copy Config files ##
152 .if !exists(${CONFIGPATH})
153                 mkdir ${CONFIGPATH}
154 .endif
155                 cp  ../conf/opengatemmng.conf.sample ${CONFIGPATH}
156                 cp  ../conf/warningmail.sample ${CONFIGPATH}
157                 cp  ../conf/warningmail.sample.en ${CONFIGPATH}
158                 #
159                 #-------------------------------------------------------#
160                 # COPY xx.conf.sample to xx and EDIT it.                #
161                 #  Eg. 'cp opengatemmng.conf.sample  opengatemmng.conf' #
162                 #      'vi opengatemmng.conf'                           #
163                 #-------------------------------------------------------#
164
165 opengatemchk.o: ${HDRS}
166                 ${CC} ${CFLAGS} -DMAKEDIR='"${MAKEDIR}"' -c $<
167
168 opengatemreg.o: ${HDRS}
169                 ${CC} ${CFLAGS} -DMAKEDIR='"${MAKEDIR}"' -c $<
170
171 opengatemup.o:  ${HDRS}
172                 ${CC} ${CFLAGS} -DMAKEDIR='"${MAKEDIR}"' -c $<
173
174 opengatemmail.o:        ${HDRS}
175                 ${CC} ${CFLAGS} -DMAKEDIR='"${MAKEDIR}"' -c $<
176
177 opengatemown.o: ${HDRS}
178                 ${CC} ${CFLAGS} -DMAKEDIR='"${MAKEDIR}"' -c $<
179
180 opengatemfwd.o: ${HDRS}
181                 ${CC} ${CFLAGS} -DMAKEDIR='"${MAKEDIR}"' -c $<
182
183 util.o:         ${HDRS}
184
185 mamagementdb.o: ${HDRS}
186 .if !exists(/usr/local/include/mysql)
187                 ${CC} ${CFLAGS} -DMYSQL_NOT_INSTALLED -c $<
188 .endif
189
190 workdb.o:       ${HDRS}
191 .if !exists(/usr/local/include/sqlite3.h)
192                 ${CC} ${CFLAGS} -DSQLITE3_NOT_INSTALLED -c $<
193 .endif
194
195 error.o:        ${HDRS}
196
197 getparam.o:     ${HDRS}
198
199 messages.o:     ${HDRS}
200
201 cgi.o:          ${HDRS}
202
203 getmac.o:       ${HDRS}
204
205 queue.o:        ${HDRS}
206
207 ipfw.o:         ${HDRS}
208
209 proc.o:         ${HDRS}
210
211 auth.o:         ${HDRS}
212
213 auth-pam.o:     ${HDRS}
214
215 auth-ftps.o:    ${HDRS}
216
217 auth-pop3s.o:   ${HDRS}
218
219 auth-rad.o:     ${HDRS}
220
221 auth-ldap.o:    ${HDRS}
222 .if !exists(/usr/local/include/ldap.h)
223                 ${CC} ${CFLAGS} -DLDAP_NOT_INSTALLED -c $<
224 .endif
225
226 alarms.o:       ${HDRS}
227
228 udpcli.o:       ${HDRS}