"Fossies" - the Fresh Open Source Software Archive 
Member "elog-3.1.4-3/Makefile" (19 Feb 2021, 5876 Bytes) of package /linux/www/elog-3.1.4-3.tar.gz:
As a special service "Fossies" has tried to format the requested text file into HTML format (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
See also the latest
Fossies "Diffs" side-by-side code changes report for "Makefile":
3.1.4-2_vs_3.1.4-3.
1 # Simple makefile for elogd
2 #
3 # S. Ritt, May 12th 2000
4 # install/clean section by Th. Bullinger, Apr. 26th, 2002
5 #############################################################
6
7 #
8 # Directories for installation, modify if needed
9 #
10
11 ifndef PREFIX
12 PREFIX = /usr/local
13 endif
14
15 ifndef MANDIR
16 MANDIR = $(ROOT)$(PREFIX)/man
17 endif
18
19 ELOGDIR = $(ROOT)$(PREFIX)/elog
20 DESTDIR = $(ROOT)$(PREFIX)/bin
21 SDESTDIR = $(ROOT)$(PREFIX)/sbin
22 RCDIR = $(ROOT)/etc/rc.d/init.d
23 SRVDIR = $(ROOT)/usr/lib/systemd/system
24
25 # flag for SSL support
26 USE_SSL = 1
27
28 # flag for Kerberos support, please turn off if you don't need Kerberos
29 USE_KRB5 = 0
30
31 # flag for LDAP support, please turn off if you don't need LDAP
32 USE_LDAP = 0
33
34 # flag for PAM support, please turn of if you don't need PAM
35 USE_PAM = 0
36
37 #############################################################
38
39 # Default compilation flags unless stated otherwise.
40 CFLAGS += -O3 -funroll-loops -fomit-frame-pointer -W -Wall -Wno-deprecated-declarations -Wno-unused-results -Imxml
41
42 CC = gcc
43 EXECS = elog elogd elconv
44 OBJS = mxml.o crypt.o regex.o
45 GIT_REVISION = src/git-revision.h
46 BINOWNER = bin
47 BINGROUP = bin
48
49 # Option to use our own implementation of strlcat, strlcpy
50 NEED_STRLCPY = 1
51
52 INSTALL = `which install`
53 RM = /bin/rm -f
54
55 OSTYPE = $(shell uname)
56
57 ifeq ($(OSTYPE),SunOS)
58 CC = gcc
59 LIBS += -lsocket -lnsl
60 CFLAGS =
61 INSTALL = /usr/ucb/install
62 RM = /usr/bin/rm -f
63 endif
64
65 ifeq ($(OSTYPE),OpenBSD)
66 LIBS += -lcrypto
67 endif
68
69 ifeq ($(OSTYPE),Darwin)
70 OSTYPE=darwin
71 endif
72
73 ifeq ($(OSTYPE),darwin)
74 CC = cc
75 BINOWNER = root
76 BINGROUP = admin
77 NEED_STRLCPY =
78 CFLAGS += -I/opt/local/include
79 LIBS += -L/opt/local/lib
80 endif
81
82 ifeq ($(OSTYPE),FreeBSD)
83 CC = gcc
84 BINOWNER = root
85 BINGROUP = wheel
86 endif
87
88 ifeq ($(OSTYPE),Linux)
89 CC = gcc
90 endif
91
92 ifdef USE_SSL
93 ifeq ($(USE_SSL),1)
94 override CFLAGS += -DHAVE_SSL
95 LIBS += -lssl
96 endif
97 endif
98
99 ifdef USE_KRB5
100 ifeq ($(USE_KRB5),1)
101 override CFLAGS += -DHAVE_KRB5
102 LIBS += -lkrb5
103 endif
104 endif
105
106 ifdef USE_LDAP
107 ifeq ($(USE_LDAP),1)
108 override CFLAGS += -DHAVE_LDAP
109 LIBS += -lldap -llber
110 endif
111 endif
112
113 ifdef USE_PAM
114 ifeq ($(USE_PAM),1)
115 override CFLAGS += -DHAVE_PAM
116 LIBS += -lpam -llber
117 endif
118 endif
119
120 ifdef NEED_STRLCPY
121 OBJS += strlcpy.o
122 endif
123
124 WHOAMI = $(shell whoami)
125 ifeq ($(WHOAMI),root)
126 BINFLAGS = -o ${BINOWNER} -g ${BINGROUP}
127 endif
128
129 all: $(EXECS)
130
131 # put current GIT revision into header file to be included by programs
132 $(GIT_REVISION): src/elogd.c src/elog.c
133 type git &> /dev/null; if [ $$? -eq 1 ]; then REV="unknown" ;else REV=`git log -n 1 --pretty=format:"%ad - %h"`; fi; echo \#define GIT_REVISION \"$$REV\" > $(GIT_REVISION)
134
135 regex.o: src/regex.c src/regex.h
136 $(CC) $(CFLAGS) -w -c -o regex.o src/regex.c
137
138 crypt.o: src/crypt.c
139 $(CC) $(CFLAGS) -w -c -o crypt.o src/crypt.c
140
141 auth.o: src/auth.c
142 $(CC) $(CFLAGS) -w -c -o auth.o src/auth.c
143
144 mxml.o: mxml/mxml.c mxml/mxml.h
145 $(CC) $(CFLAGS) -c -o mxml.o mxml/mxml.c
146
147 strlcpy.o: mxml/strlcpy.c mxml/strlcpy.h
148 $(CC) $(CFLAGS) -c -o strlcpy.o mxml/strlcpy.c
149
150 elogd: src/elogd.c auth.o $(OBJS) $(GIT_REVISION)
151 $(CC) $(CFLAGS) -o elogd src/elogd.c auth.o $(OBJS) $(LIBS)
152
153 elog: src/elog.c $(OBJS) $(GIT_REVISION)
154 $(CC) $(CFLAGS) -o elog src/elog.c $(OBJS) $(LIBS)
155
156 debug: src/elogd.c auth.o $(OBJS)
157 $(CC) -g $(CFLAGS) -O0 -o elogd src/elogd.c auth.o $(OBJS) $(LIBS)
158
159 %: src/%.c
160 $(CC) $(CFLAGS) -o $@ $< $(LIBS)
161
162 ifeq ($(OSTYPE),CYGWIN_NT-5.1)
163 loc: locext.exe
164 for lang in resources/eloglang*; do \
165 ./locext.exe src/elogd.c $$lang; echo locext src/elogd.c $$lang;\
166 done
167 else
168 locext: src/locext.c
169 loc: locext
170 @for lang in resources/eloglang*; do \
171 ./locext src/elogd.c $$lang; echo locext src/elogd.c $$lang;\
172 done
173 endif
174
175 update: $(EXECS)
176 @$(INSTALL) -v -m 0755 ${BINFLAGS} elogd $(SDESTDIR)
177
178 install: $(EXECS)
179 @$(INSTALL) -m 0755 -d $(DESTDIR) $(SDESTDIR) $(MANDIR)/man1/ $(MANDIR)/man8/
180 @$(INSTALL) -m 0755 -d $(ELOGDIR)/scripts/ $(ELOGDIR)/resources/ $(ELOGDIR)/ssl/ $(ELOGDIR)/themes/default/icons
181 @$(INSTALL) -m 0755 -d $(ELOGDIR)/logbooks/demo
182 @$(INSTALL) -m 0755 -d $(ELOGDIR)/logbooks/demo/2001
183 @$(INSTALL) -v -m 0755 ${BINFLAGS} elog elconv $(DESTDIR)
184 @$(INSTALL) -v -m 0755 ${BINFLAGS} elogd $(SDESTDIR)
185 @$(INSTALL) -v -m 0644 man/elog.1 man/elconv.1 $(MANDIR)/man1/
186 @$(INSTALL) -v -m 0644 man/elogd.8 $(MANDIR)/man8/
187 @$(INSTALL) -v -m 0644 scripts/*.js $(ELOGDIR)/scripts/
188
189 @echo "Installing CKeditor to $(ELOGDIR)/scripts/ckeditor"
190 @cp -r scripts/* $(ELOGDIR)/scripts
191
192 @echo "Installing resources to $(ELOGDIR)/resources"
193 @$(INSTALL) -m 0644 resources/* $(ELOGDIR)/resources/
194 @if [ ! -f $(ELOGDIR)/ssl/server.crt ]; then \
195 $(INSTALL) -v -m 0644 ssl/server.crt $(ELOGDIR)/ssl/ ;\
196 fi
197 @if [ ! -f $(ELOGDIR)/ssl/server.key ]; then \
198 $(INSTALL) -v -m 0644 ssl/server.key $(ELOGDIR)/ssl/ ;\
199 fi
200
201 @echo "Installing themes to $(ELOGDIR)/themes"
202 @cp -r themes/* $(ELOGDIR)/themes
203
204 @echo "Installing example logbook to $(ELOGDIR)/logbooks/demo"
205 @if [ ! -f $(ELOGDIR)/logbooks/demo/2001 ]; then \
206 $(INSTALL) -v -m 0644 logbooks/demo/2001/* $(ELOGDIR)/logbooks/demo/2001 ; \
207 fi
208
209 @if [ ! -f $(ELOGDIR)/elogd.cfg ]; then \
210 $(INSTALL) -v -m 644 elogd.cfg.example $(ELOGDIR)/elogd.cfg ; \
211 fi
212
213
214 ifneq ($(OSTYPE),darwin)
215 @sed "s#\@PREFIX\@#$(PREFIX)#g" elogd.init_template > elogd.init
216 @if [ ! -f $(RCDIR)/elogd ]; then \
217 $(INSTALL) -v -m 0755 -D elogd.init $(RCDIR)/elogd ; \
218 fi
219 endif
220
221 ifneq ("$(wildcard $(SRVDIR))", "")
222 @$(INSTALL) -v -m 0644 -D elogd.service $(SRVDIR)
223 @echo The elogd service can now be started with
224 @echo " sudo systemctl start elogd"
225 endif
226
227 ifeq ($(OSTYPE),darwin)
228 @$(INSTALL) -v -m 0644 elogd.plist /Library/LaunchDaemons/ch.psi.elogd.plist
229 @echo The elogd service can now be started with
230 @echo " sudo launchctl load /Library/LaunchDaemons/ch.psi.elogd.plist"
231 endif
232
233 restart:
234 $(RCDIR)/elogd restart
235 clean:
236 -$(RM) *~ $(EXECS) regex.o crypt.o auth.o mxml.o strlcpy.o locext