Makefile.am 12.5 KB
Newer Older
1
# $Id: Makefile.am,v 1.68 2003/10/03 08:42:34 ceder Exp $
2
# Copyright (C) 1998-1999, 2001-2003  Lysator Academic Computer Association.
Per Cederqvist's avatar
Per Cederqvist committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#
# This file is part of the LysKOM server.
# 
# LysKOM is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by 
# the Free Software Foundation; either version 1, or (at your option) 
# any later version.
# 
# LysKOM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
# 
# You should have received a copy of the GNU General Public License
# along with LysKOM; see the file COPYING.  If not, write to
# Lysator, c/o ISY, Linkoping University, S-581 83 Linkoping, SWEDEN,
# or the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, 
# MA 02139, USA.
#
Per Cederqvist's avatar
Per Cederqvist committed
22
# Please report bugs at http://bugzilla.lysator.liu.se/. 
Per Cederqvist's avatar
Per Cederqvist committed
23 24
#

Per Cederqvist's avatar
Per Cederqvist committed
25 26
include $(top_srcdir)/scripts/common.make

27 28
SUBDIRS = testsuite

29
AM_YFLAGS = -d
30

Per Cederqvist's avatar
Per Cederqvist committed
31
EXTRA_DIST = .cvsignore ChangeLog.1 Magics \
32 33
	call-switch.awk com-h.awk fnc-def-init.awk \
	prot-a-parse-arg-c.awk prot-a-parse-arg-h.awk \
34
	prot-a-is-legal-fnc.awk \
35
	fncdef.txt \
36
	handle-malloc-dump.el trace-mem.gdb
37 38

MOSTLYCLEANFILES = .gdbinit call-switch.incl com.h fnc-def-init.incl \
39
	fncdef-no-str-limit.txt prot-a-parse-arg.h version.incl \
40
	prot-a-is-legal-fnc.incl *.da *.bb *.gcov *.bbg \
41
	version-info.c prot-a-parse-arg.c aux-no.h paths.h
42

43
AM_CPPFLAGS = \
44
	-I../libraries/libeintr \
Per Cederqvist's avatar
Per Cederqvist committed
45
	-I$(srcdir)/../include \
Per Cederqvist's avatar
Per Cederqvist committed
46
	-I$(srcdir)/../libraries/libansi \
Per Cederqvist's avatar
Per Cederqvist committed
47
	-I$(srcdir)/../libraries/libmisc \
48
	-I$(srcdir)/../libraries/liboop \
49
	-I$(srcdir)/../libraries/adns/src \
Per Cederqvist's avatar
Per Cederqvist committed
50 51 52 53 54 55
	-I$(srcdir)/../libraries/libisc-new/src \
	-I$(srcdir)/../libraries/regex \
	-I$(srcdir)/../libraries/libcommon

top_srcdir = @top_srcdir@

56
sbin_PROGRAMS = lyskomd dbck updateLysKOM komrunning splitkomdb
57
CHECKKOMSPACE =
58

59 60
if HAVE_FSUSAGE
sbin_PROGRAMS += checkkomspace
61
CHECKKOMSPACE += checkkomspace$(EXEEXT)
62 63
endif

64
check_LIBRARIES = libcheck.a
65
libcheck_a_SOURCES = local-to-global.c ram-parse.c ram-output.c \
66 67
	log.c ram-smalloc.c memory.c getopt.c getopt1.c \
	misc-types.c
Per Cederqvist's avatar
Per Cederqvist committed
68

69
lyskomd_SOURCES = $(DISKOBJS) $(GENOBJS) \
70 71 72
        aux-item-def-parse.y \
        aux-item-def-parse.h \
	aux-item-def-scan.l \
73 74
	admin.h async.h aux-items.h cache-node.h cache.h conf-file.h \
	connections.h end-of-atomic.h exp.h internal-connections.h \
75
	text.h isc-interface.h isc-malloc.h isc-parse.h \
76
	kom-memory.h local-to-global.h log.h lyskomd.h manipulate.h \
77
	minmax.h param.h prot-a-output.h prot-a-parse.h \
78 79
	prot-a-send-async.h prot-a.h ram-output.h ram-parse.h \
	rfc931.h send-async.h server-config.h string-malloc.h \
80
	text-garb.h version-info.h sigflags.h trace-alloc.h \
81
	lockdb.h lockdb.c server-time.h oop-malloc.h oop-malloc.c \
82 83
	timewrap.h stats.h stats.c \
	misc-types.c
84
nodist_lyskomd_SOURCES = $(NODIST_DISKOBJS) $(NODIST_GENOBJS)
85

86
READ_CONFIG = string-malloc.c ram-smalloc.c conf-file.c server-config.c \
Per Cederqvist's avatar
Per Cederqvist committed
87 88
	 standalone.c

89
komrunning_SOURCES = komrunning.c pidfile.c pidfile.h $(READ_CONFIG) \
90
	misc-types.c log.c
Per Cederqvist's avatar
Per Cederqvist committed
91

92
updateLysKOM_SOURCES = updateLysKOM.c pidfile.c pidfile.h $(READ_CONFIG) \
93 94 95
	misc-types.c log.c

checkkomspace_SOURCES = checkkomspace.c $(READ_CONFIG) stderrlog.c \
96
	version-info.c misc-types.c fsusage.h fsusage.c $(GETOPT)
97

Per Cederqvist's avatar
Per Cederqvist committed
98

99
dbck_SOURCES = $(DBCK) \
100
	dbck-cache.h getopt.h standalone.c \
101
	misc-types.c stderrlog.c
102
nodist_dbck_SOURCES = $(NODIST_DBCK)
Per Cederqvist's avatar
Per Cederqvist committed
103

104
splitkomdb_SOURCES = splitkomdb.c $(READ_CONFIG) \
105
	misc-types.c log.c
106

Per Cederqvist's avatar
Per Cederqvist committed
107
lyskomd_LDADD = ../libraries/libisc-new/src/libisc.a \
108
	../libraries/liboop/liboop.a \
109
	../libraries/adns/src/libadns.a \
Per Cederqvist's avatar
Per Cederqvist committed
110 111 112
	../libraries/libmisc/libmisc.a \
	../libraries/libcommon/liblyskom-server.a \
	../libraries/regex/libregex.a \
113
	../libraries/libeintr/libeintr.a \
114 115
	../libraries/libansi/libansi.a \
	-lm
Per Cederqvist's avatar
Per Cederqvist committed
116

Per Cederqvist's avatar
Per Cederqvist committed
117 118
dbck_LDADD = ../libraries/libmisc/libmisc.a \
	../libraries/libcommon/liblyskom-server.a \
119
	../libraries/libeintr/libeintr.a \
Per Cederqvist's avatar
Per Cederqvist committed
120 121 122
	../libraries/libansi/libansi.a

LDADD = ../libraries/libmisc/libmisc.a \
123
	../libraries/libeintr/libeintr.a \
Per Cederqvist's avatar
Per Cederqvist committed
124
	../libraries/libansi/libansi.a
Per Cederqvist's avatar
Per Cederqvist committed
125 126

# Files that implements protocol A.
127 128
NODIST_PROTA = prot-a-parse-arg.c
PROTA =  prot-a-output.c prot-a-parse.c prot-a.c \
Per Cederqvist's avatar
Per Cederqvist committed
129 130 131 132 133
	 prot-a-send-async.c

# Implementations of the atomic calls.

ATOMS = text.c membership.c person.c conference.c session.c admin.c \
134
	regex-match.c aux-items.c debug.c
Per Cederqvist's avatar
Per Cederqvist committed
135 136

# These files are needed by all versions of the LysKOM server.
137
NODIST_GENOBJS = $(NODIST_PROTA) aux-no.h
Per Cederqvist's avatar
Per Cederqvist committed
138 139
GENOBJS = connections.c log.c $(ATOMS) \
          send-async.c server-config.c text-garb.c \
140
          isc-parse.c memory.c $(PROTA) \
Per Cederqvist's avatar
Per Cederqvist committed
141 142 143 144 145 146
	  internal-connections.c rfc931.c isc-malloc.c \
	  conf-file.c local-to-global.c 


# Files for lyskomd.

147
NODIST_DISKOBJS = version-info.c
Per Cederqvist's avatar
Per Cederqvist committed
148
DISKOBJS = ramkomd.c ram-smalloc.c simple-cache.c ram-parse.c ram-output.c \
149
	disk-end-of-atomic.c cache-node.c string-malloc.c
Per Cederqvist's avatar
Per Cederqvist committed
150 151 152 153

# Files for dbck.

GETOPT = getopt.c getopt1.c
154
NODIST_DBCK = version-info.c
155
DBCK = dbck.c dbck-cache.c ram-smalloc.c ram-parse.c server-config.c \
156
	ram-output.c memory.c conf-file.c $(GETOPT) \
157
	local-to-global.c lockdb.h lockdb.c
Per Cederqvist's avatar
Per Cederqvist committed
158 159 160 161 162 163 164 165 166 167 168

# Files for encrypt (a program to transform the database from unencrypted
# apasswords to encrypted).  No longer supported.

ENCRYPT = encrypt-passwd.c dbck-cache.c ram-smalloc.c ram-parse.c \
	server-config.c\
	ram-output.c memory.c

BUILT_SOURCES = prot-a-parse-arg.c version-info.c \
	call-switch.incl com.h fnc-def-init.incl \
	prot-a-parse-arg.h fncdef-no-str-limit.txt .gdbinit \
169
	version.incl prot-a-is-legal-fnc.incl aux-no.h paths.h
Per Cederqvist's avatar
Per Cederqvist committed
170 171 172 173 174 175 176 177 178 179 180 181

call-switch.incl: call-switch.awk fncdef-no-str-limit.txt
	$(AWK) -f $(srcdir)/call-switch.awk fncdef-no-str-limit.txt \
		> call-switch.incl

com.h: com-h.awk fncdef-no-str-limit.txt
	$(AWK) -f $(srcdir)/com-h.awk fncdef-no-str-limit.txt > com.h

fnc-def-init.incl: fnc-def-init.awk fncdef-no-str-limit.txt
	$(AWK) -f $(srcdir)/fnc-def-init.awk fncdef-no-str-limit.txt \
		> fnc-def-init.incl

182 183 184 185
prot-a-is-legal-fnc.incl: fncdef-no-str-limit.txt prot-a-is-legal-fnc.awk
	$(AWK) -f $(srcdir)/prot-a-is-legal-fnc.awk fncdef-no-str-limit.txt \
		> prot-a-is-legal-fnc.incl

Per Cederqvist's avatar
Per Cederqvist committed
186 187 188 189 190 191 192 193 194 195 196 197 198 199
prot-a-parse-arg.c: prot-a-parse-arg-c.awk fncdef.txt prot-a-parse-arg.h
	$(AWK) -f $(srcdir)/prot-a-parse-arg-c.awk $(srcdir)/fncdef.txt \
		> prot-a-parse-arg.c

prot-a-parse-arg.h: prot-a-parse-arg-h.awk fncdef-no-str-limit.txt
	$(AWK) -f $(srcdir)/prot-a-parse-arg-h.awk \
		fncdef-no-str-limit.txt > prot-a-parse-arg.h

fncdef-no-str-limit.txt: fncdef.txt
	(echo \# Do not edit this file! It is generated from fncdef.txt.;\
	  cat $(srcdir)/fncdef.txt) \
	| sed 's/([^)]*)//g' > fncdef-no-str-limit.txt

version.incl: $(top_srcdir)/versions
Per Cederqvist's avatar
Per Cederqvist committed
200
	echo '/* Do not edit -- automatically generated file */'      > $@.tmp
Per Cederqvist's avatar
Per Cederqvist committed
201
	sed -n 's/SERVER-COMPAT-VERSION: //p' $(top_srcdir)/versions  >>$@.tmp
Per Cederqvist's avatar
Per Cederqvist committed
202
	echo '/* Do not edit -- automatically generated file */'      >>$@.tmp
Per Cederqvist's avatar
Per Cederqvist committed
203 204 205
	mv $@.tmp $@

version-info.c: $(top_srcdir)/versions
Per Cederqvist's avatar
Per Cederqvist committed
206
	echo '/* Do not edit -- automatically generated file */'   > $@.tmp
207 208 209
	echo '#ifdef HAVE_CONFIG_H'                                >>$@.tmp
	echo '#  include <config.h>'                               >>$@.tmp
	echo '#endif'                                              >>$@.tmp
Per Cederqvist's avatar
Per Cederqvist committed
210 211 212 213 214 215
	echo '#include <limits.h>'                                 >>$@.tmp
	echo '#include <sys/types.h>'                              >>$@.tmp
	echo '#include "misc-types.h"'                             >>$@.tmp
	echo '#include "s-string.h"'                               >>$@.tmp
	echo '#include "kom-types.h"'                              >>$@.tmp
	echo '#include "version-info.h"'                           >>$@.tmp
216
	echo 'const Version_info_internal kom_version_info = {'    >>$@.tmp
Per Cederqvist's avatar
Per Cederqvist committed
217 218 219 220 221 222 223
	sed -n 's/PROTOCOL-A-LEVEL: \(.*\)/    \1,/p' \
		$(top_srcdir)/versions                               >>$@.tmp
	sed -n 's/SERVER-SOFTWARE: \(.*\)/    "\1",/p' \
		$(top_srcdir)/versions                               >>$@.tmp
	sed -n 's/SERVER-VERSION: \(.*\)/    "\1"/p' \
		$(top_srcdir)/versions                               >>$@.tmp
	echo '};'                                                  >>$@.tmp
Per Cederqvist's avatar
Per Cederqvist committed
224
	echo '/* Do not edit -- automatically generated file */'   >>$@.tmp
Per Cederqvist's avatar
Per Cederqvist committed
225 226
	mv $@.tmp $@

227
aux-no.h: $(top_srcdir)/run-support/aux-items.conf Makefile
Per Cederqvist's avatar
Per Cederqvist committed
228
	$(RM) $@ $@.tmp
229
	echo '/* Do not edit -- automatically generated file */'    >$@.tmp
Per Cederqvist's avatar
Per Cederqvist committed
230 231 232 233 234 235 236 237 238 239 240 241 242 243
	echo '#ifndef AUX_H_INCLUDED'				    >>$@.tmp
	echo '#define AUX_H_INCLUDED'				    >>$@.tmp
	echo 'enum aux_no {'					    >>$@.tmp
	LC_ALL=C LC_CTYPE=C LANG=C sed \
	    -e '/^#/d' \
	    -e '/^{/,/^}/d' \
	    -e 's/^\([0-9]*\) : \([a-z\-]*\) .*/aux_\2 \1/' \
	    -e '/^ *$$/d' \
	    -e 'y/-/_/' \
	    < $(top_srcdir)/run-support/aux-items.conf \
	| awk '{printf "    %-25s = %5s,\n", $$1, $$2}'		    >>$@.tmp
	echo '};'						    >>$@.tmp
	echo '#endif'						    >>$@.tmp
	echo '/* Do not edit -- automatically generated file */'    >>$@.tmp
244 245
	chmod 444 $@.tmp
	mv -f $@.tmp $@
Per Cederqvist's avatar
Per Cederqvist committed
246 247


Per Cederqvist's avatar
Per Cederqvist committed
248
.gdbinit: Makefile
249
	$(RM) .gdbinit
Per Cederqvist's avatar
Per Cederqvist committed
250 251 252 253
	echo handle 13 nostop noprint 			>.gdbinit
	echo dir $(top_srcdir)/src/libraries/libcommon	>>.gdbinit
	echo dir $(top_srcdir)/src/libraries/libansi	>>.gdbinit
	echo dir $(top_srcdir)/src/libraries/libisc-new	>>.gdbinit
Per Cederqvist's avatar
Per Cederqvist committed
254
	echo dir $(top_srcdir)/src/libraries/liboop	>>.gdbinit
Per Cederqvist's avatar
Per Cederqvist committed
255 256
	echo dir $(top_srcdir)/src/libraries/libmisc	>>.gdbinit

257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
DEFP = $(top_srcdir)/scripts/definepath "$(top_srcdir)" "$(prefix)"

paths.h: $(top_srcdir)/scripts/unprefix $(top_srcdir)/scripts/definepath \
		Makefile
	$(RM) $@ $@.tmp
	echo '/* Do not edit -- automatically generated file */'    >  $@.tmp
	echo '#define DEFAULT_PREFIX "'"$(prefix)"'"'               >> $@.tmp
	$(DEFP) CONFIG_FILE      "$(sysconfdir)/lyskomd.conf"       >> $@.tmp
	$(DEFP) DATA_FILE        "$(dbdir)/lyskomd-data"	    >> $@.tmp
	$(DEFP) BACKUP_FILE      "$(dbdir)/lyskomd-backup"	    >> $@.tmp
	$(DEFP) PREV_BACKUP_FILE "$(dbdir)/lyskomd-backup-prev"	    >> $@.tmp
	$(DEFP) LOCK_FILE        "$(dbdir)/lyskomd-lock"	    >> $@.tmp
	$(DEFP) TEXT_FILE        "$(dbdir)/lyskomd-texts"	    >> $@.tmp
	$(DEFP) NUMBER_FILE      "$(dbdir)/number.txt"		    >> $@.tmp
	$(DEFP) NUMBER_FILE_TMP  "$(dbdir)/number.tmp"		    >> $@.tmp
	$(DEFP) TEXT_BACKUP_FILE "$(dbdir)/lyskomd-texts-backup"    >> $@.tmp
	$(DEFP) EXPORT_DIR       "$(exportdir)"	 		    >> $@.tmp
	$(DEFP) LYSKOMD_LOG      "$(localstatedir)/lyskomd.log"     >> $@.tmp
	$(DEFP) LYSKOMD_STATS    "$(localstatedir)/lyskomd.stats"   >> $@.tmp
	$(DEFP) LYSKOMD_PID      "$(localstatedir)/run/lyskomd.pid" >> $@.tmp
	$(DEFP) MEMORY_USAGE     "$(localstatedir)/lyskomd.memory"  >> $@.tmp
	$(DEFP) AUX_FILE         "$(sysconfdir)/aux-items.conf"     >> $@.tmp
	$(DEFP) STATUS_FILE      "$(dbdir)/status"		    >> $@.tmp
	$(DEFP) CONNECTIONS_FILE "$(localstatedir)/lyskomd.clients" >> $@.tmp
	$(DEFP) CONNECTIONS_TMP  "$(localstatedir)/lyskomd.clnt.tmp">> $@.tmp
	$(DEFP) CORE_DIR         "$(localstatedir)/lyskomd.cores"   >> $@.tmp
	$(DEFP) LYSKOMD_PATH     "$(sbindir)/lyskomd$(EXEEXT)"      >> $@.tmp
	$(DEFP) SAVECORE_PATH "$(sbindir)/savecore-lyskom$(EXEEXT)" >> $@.tmp
285 286
	echo "/* External programs */"                              >> $@.tmp
	$(DEFP) SENDMAIL_PATH    "$(SENDMAIL)"                      >> $@.tmp
287 288 289 290
	echo '/* Do not edit -- automatically generated file */'    >> $@.tmp
	chmod 444 $@.tmp
	mv -f $@.tmp $@

291
check-lyskomd: libcheck.a lyskomd dbck $(CHECKKOMSPACE)
Per Cederqvist's avatar
Per Cederqvist committed
292 293 294 295 296
	cd testsuite && $(MAKE) check-lyskomd

check-leaks: libcheck.a lyskomd dbck
	cd testsuite && $(MAKE) check-leaks

Per Cederqvist's avatar
Per Cederqvist committed
297 298 299
check-l2g: libcheck.a
	cd testsuite && $(MAKE) check-l2g

Per Cederqvist's avatar
Per Cederqvist committed
300 301 302
# Make sure these gets recompiled if $(prefix) changes.
server-config.o: Makefile
updateLysKOM.o: Makefile
303

304
# After a "make clean" followed by "make check", these are needed.
305 306
aux-items.o: aux-no.h
text.o: aux-no.h
307

308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332
admin.o: com.h
aux-item-def-parse.o: com.h
aux-items.o: com.h
conference.o: com.h
connections.o: com.h
dbck.o: com.h
debug.o: com.h
internal-connections.o: com.h
isc-parse.o: com.h
membership.o: com.h
person.o: com.h
prot-a-output.o: com.h
prot-a-parse-arg.o: com.h
prot-a-parse.o: com.h
prot-a-send-async.o: com.h
prot-a.o: com.h
ramkomd.o: com.h
regex-match.o: com.h
send-async.o: com.h
server-config.o: com.h
session.o: com.h
simple-cache.o: com.h
standalone.o: com.h
text-garb.o: com.h
text.o: com.h
333
server-config.o: paths.h
334 335 336 337 338 339

connections.o: fnc-def-init.incl call-switch.incl
admin.o: version.incl
prot-a.o: fnc-def-init.incl prot-a-is-legal-fnc.incl
standalone.o: version.incl

340 341 342
# "make install" without a prior "make" requires these.
connections.o: prot-a-parse-arg.h

343 344 345
# This dependency is needed after a "make maintainer-clean".
aux-item-def-scan.o: aux-item-def-parse.h

346
# 
347
all-recursive: lyskomd$(EXEEXT) dbck$(EXEEXT)
348
check-recursive: libcheck.a lyskomd$(EXEEXT) dbck$(EXEEXT) $(CHECKKOMSPACE)