OSDN Git Service

added cleanup of emacs autosave in Makefile
[opengatem/opengatem.git] / mdsrc / Makefile
1 ################ Change following ########################
2 ##  some other parameters exist in opengatemd.h  ########
3 ##########################################################
4 CONFIGPATH = /etc/opengate        ## directory of config file
5 INSTALLBINPATH = /usr/local/bin   ## install dir of executable file
6 MAKEDIR != pwd                  ## save present directory
7
8 .if exists(/usr/local/include/mysql)
9 CFLAGSMYSQL = -I/usr/local/include/mysql -pipe -fno-strict-aliasing
10 LIBMYSQL = -L/usr/local/lib/mysql -lmysqlclient  -pthread -lz -lm
11 .endif
12
13 .if exists(/usr/local/include/sqlite3.h)
14 LIBSQLITE = -lsqlite3 -lpthread
15 .endif
16
17 ## This is memory leak check tool for debugging
18 #LIBCCMALLOC = -lccmalloc -L/usr/local/lib
19
20 CFLAGS= -g -O3 -Wall -I/usr/local/include ${CFLAGSMYSQL}
21
22 LIBS = -lezxml -lpcap -L../ezxml -L/usr/local/lib  ${LIBSQLITE} ${LIBMYSQL} ${LIBCCMALLOC}
23
24 OBJS = util.o error.o getparam.o managementdb.o workdb.c ipfw.o pcap.o packetcache.o macdbcache.o session.o ttlcheck.o udpserv.o watchlistcache.o signal.o
25 HDRS = opengatemd.h
26
27 MDMAINPROGO = opengatemd.o
28 MDMAINPROG = opengatemd
29
30 LIBOPT = ezxml
31
32 CLEANFILES = *.o *.core a.out 
33
34 all:    ${MDMAINPROG} ${LIBOPT}
35
36 opengatemd:     ${OBJS} ${MDMAINPROGO} ${LIBOPT}
37                 ${CC} ${CFLAGS} -o $@ ${OBJS} ${MDMAINPROGO} ${LIBS}
38
39 ezxml:  
40                 ${MAKE} -C ../ezxml
41 clean:
42                 rm -f ${MDMAINPROG} ${CLEANFILES}
43                 ${MAKE} clean -C ../ezxml
44                 rm -f *~ ../*/*~  ../*~ ../*/*/*~     #remove emacs backup
45                 rm -f \#* ../*/\#* ../\#* ../*/*/\#*  #remove emacs autosave
46
47
48
49 install:        install-md-prg install-conf rm-lockfile
50
51 rm-lockfile:    #
52                 rm -f /tmp/opengatemd.lock
53                 rm -f /tmp/opengate.lock
54
55 install-md-prg: ${MDMAINPROG}
56                 ## Install program and Set S bit ##
57 .if !exists(${INSTALLBINPATH})
58                 mkdir ${INSTALLBINPATH}
59 .endif
60                 cp ${MDMAINPROG} ${INSTALLBINPATH}/${MDMAINPROG}
61                 chmod 4755 ${INSTALLBINPATH}/${MDMAINPROG}
62                 cp ../rc.d/${MDMAINPROG} /etc/rc.d/${MDMAINPROG}
63                 chmod 555 /etc/rc.d/${MDMAINPROG}
64                 #
65
66 install-conf:
67                 ## Copy Config files ##
68 .if !exists(${CONFIGPATH})
69                 mkdir ${CONFIGPATH}
70 .endif
71                 cp  ../conf/opengatemd.conf.sample ${CONFIGPATH}
72                 cp  ../conf/rc.firewall.sample ${CONFIGPATH}
73                 cp  ../conf/ipfwctrlmd.pl.sample ${CONFIGPATH}
74                 #
75                 #------------------------------------------------------#
76                 # COPY above x.sample to x and EDIT it.                #
77                 #   Eg. 'cp opengatemd.conf.sample  opengatemd.conf'   #
78                 #------------------------------------------------------#
79
80 opengatemd.o:   ${HDRS}
81                 ${CC} ${CFLAGS} -DMAKEDIR='"${MAKEDIR}"' -c $<
82
83 util.o:         ${HDRS}
84
85 mamagementdb.o: ${HDRS}
86 .if !exists(/usr/local/include/mysql)
87                 ${CC} ${CFLAGS} -DMYSQL_NOT_INSTALLED -c $<
88 .endif
89
90 workdb.o:       ${HDRS}
91 .if !exists(/usr/local/include/sqlite3.h)
92                 ${CC} ${CFLAGS} -DSQLITE3_NOT_INSTALLED -c $<
93 .endif
94
95 error.o:        ${HDRS}
96
97 getparam.o:     ${HDRS}
98
99 ipfw.o:         ${HDRS}
100
101 pcap.o:         ${HDRS}
102
103 packetcache.o:  ${HDRS}
104
105 macdbcache.o:   ${HDRS}
106
107 session.o:      ${HDRS}
108
109 ttlcheck.o:     ${HDRS}
110
111 getmac.o:       ${HDRS}
112
113 queue.o:        ${HDRS}
114
115 udpserv.o:      ${HDRS}
116
117 watchlistcache.o:       ${HDRS}
118