OSDN Git Service

added cleanup of emacs autosave in Makefile
[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 signal.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 *~ ../*/*~  ../*~ ../*/*/*~     #remove emacs backup
82                 rm -f \#* ../*/\#* ../\#* ../*/*/\#*  #remove emacs autosave
83
84 # install mac registration and upating systems
85 install:        install-chkcgi install-regcgi install-upcgi install-owncgi install-fwdcgi install-mailbin install-conf install-html
86
87 #install only mac registration system
88 installmreg:    install-chkcgi install-regcgi install-conf install-html
89
90 #install only mac updating system
91 installmup:     install-upcgi install-mailbin install-conf install-html
92
93 #install only mac reg/update by owner oneself
94 installmown:    install-owncgi install-fwdcgi install-mailbin install-conf install-html
95
96 install-chkcgi: ${CHKPROG}
97                 ## Copy CGI program and Set S bit ##
98 .if !exists(${INSTALLCGIPATH})
99                 mkdir ${INSTALLCGIPATH}
100 .endif
101                 cp ${CHKPROG} ${INSTALLCGIPATH}/${CHKPROG}.cgi
102                 chmod 4755 ${INSTALLCGIPATH}/${CHKPROG}.cgi
103
104 install-regcgi: ${REGPROG}
105                 ## Copy CGI program and Set S bit ##
106 .if !exists(${INSTALLCGIPATH})
107                 mkdir ${INSTALLCGIPATH}
108 .endif
109                 cp ${REGPROG} ${INSTALLCGIPATH}/${REGPROG}.cgi
110                 chmod 4755 ${INSTALLCGIPATH}/${REGPROG}.cgi
111
112 install-upcgi:  ${UPPROG}
113                 ## Copy CGI program and Set S bit ##
114 .if !exists(${INSTALLCGIPATH})
115                 mkdir ${INSTALLCGIPATH}
116 .endif
117                 cp ${UPPROG} ${INSTALLCGIPATH}/${UPPROG}.cgi
118                 chmod 4755 ${INSTALLCGIPATH}/${UPPROG}.cgi
119
120 install-owncgi: ${OWNPROG}
121                 ## Copy CGI program and Set S bit ##
122 .if !exists(${INSTALLCGIPATH})
123                 mkdir ${INSTALLCGIPATH}
124 .endif
125                 cp ${OWNPROG} ${INSTALLCGIPATH}/${OWNPROG}.cgi
126                 chmod 4755 ${INSTALLCGIPATH}/${OWNPROG}.cgi
127
128 install-fwdcgi: ${FWDPROG}
129                 ## Copy CGI program and Set S bit ##
130 .if !exists(${INSTALLCGIPATH})
131                 mkdir ${INSTALLCGIPATH}
132 .endif
133                 cp ${FWDPROG} ${INSTALLCGIPATH}/${FWDPROG}.cgi
134                 chmod 4755 ${INSTALLCGIPATH}/${FWDPROG}.cgi
135
136 install-mailbin:        ${MAILPROG}
137 .if !exists(${INSTALLBINPATH})
138                 mkdir ${INSTALLBINPATH}
139 .endif
140                 cp ${MAILPROG} ${INSTALLBINPATH}/${MAILPROG}
141                 chmod 4755 ${INSTALLBINPATH}/${MAILPROG}
142
143 install-html:
144                 ## Copy HTML documents and etc ##
145 .if !exists(${INSTALLDOCPATH})
146                 mkdir ${INSTALLDOCPATH}
147 .endif
148                 cp -R ../html/* ${INSTALLDOCPATH}
149                 mv ${INSTALLDOCPATH}/index.html.var ${DOCUMENTROOT}/index.html.var.opengatem
150
151 install-conf:
152                 ## Copy Config files ##
153 .if !exists(${CONFIGPATH})
154                 mkdir ${CONFIGPATH}
155 .endif
156                 cp  ../conf/opengatemmng.conf.sample ${CONFIGPATH}
157                 cp  ../conf/warningmail.sample ${CONFIGPATH}
158                 cp  ../conf/warningmail.sample.en ${CONFIGPATH}
159                 #
160                 #-------------------------------------------------------#
161                 # COPY xx.conf.sample to xx and EDIT it.                #
162                 #  Eg. 'cp opengatemmng.conf.sample  opengatemmng.conf' #
163                 #      'vi opengatemmng.conf'                           #
164                 #-------------------------------------------------------#
165
166 opengatemchk.o: ${HDRS}
167                 ${CC} ${CFLAGS} -DMAKEDIR='"${MAKEDIR}"' -c $<
168
169 opengatemreg.o: ${HDRS}
170                 ${CC} ${CFLAGS} -DMAKEDIR='"${MAKEDIR}"' -c $<
171
172 opengatemup.o:  ${HDRS}
173                 ${CC} ${CFLAGS} -DMAKEDIR='"${MAKEDIR}"' -c $<
174
175 opengatemmail.o:        ${HDRS}
176                 ${CC} ${CFLAGS} -DMAKEDIR='"${MAKEDIR}"' -c $<
177
178 opengatemown.o: ${HDRS}
179                 ${CC} ${CFLAGS} -DMAKEDIR='"${MAKEDIR}"' -c $<
180
181 opengatemfwd.o: ${HDRS}
182                 ${CC} ${CFLAGS} -DMAKEDIR='"${MAKEDIR}"' -c $<
183
184 util.o:         ${HDRS}
185
186 mamagementdb.o: ${HDRS}
187 .if !exists(/usr/local/include/mysql)
188                 ${CC} ${CFLAGS} -DMYSQL_NOT_INSTALLED -c $<
189 .endif
190
191 workdb.o:       ${HDRS}
192 .if !exists(/usr/local/include/sqlite3.h)
193                 ${CC} ${CFLAGS} -DSQLITE3_NOT_INSTALLED -c $<
194 .endif
195
196 error.o:        ${HDRS}
197
198 getparam.o:     ${HDRS}
199
200 messages.o:     ${HDRS}
201
202 cgi.o:          ${HDRS}
203
204 getmac.o:       ${HDRS}
205
206 queue.o:        ${HDRS}
207
208 ipfw.o:         ${HDRS}
209
210 proc.o:         ${HDRS}
211
212 auth.o:         ${HDRS}
213
214 auth-pam.o:     ${HDRS}
215
216 auth-ftps.o:    ${HDRS}
217
218 auth-pop3s.o:   ${HDRS}
219
220 auth-rad.o:     ${HDRS}
221
222 auth-ldap.o:    ${HDRS}
223 .if !exists(/usr/local/include/ldap.h)
224                 ${CC} ${CFLAGS} -DLDAP_NOT_INSTALLED -c $<
225 .endif
226
227 alarms.o:       ${HDRS}
228
229 udpcli.o:       ${HDRS}