source: trunk/Makefile.in@ 11

Last change on this file since 11 was 1, checked in by katerina, 19 years ago

Initial import

File size: 65.0 KB
RevLine 
[1]1# This program is distributed in the hope that it will be useful,
2# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
3# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
4# PARTICULAR PURPOSE.
5
6# --- boiler-plate stuff ---
7#
8SHELL = /bin/sh
9
10srcdir = @srcdir@
11srcsrc = @srcdir@/src
12srcinc = @srcdir@/include
13top_srcdir = @top_srcdir@
14
15# Don't use VPATH - it's a portability mess
16#
17# VPATH = $(top_srcdir)/src
18
19prefix = @prefix@
20exec_prefix = @exec_prefix@
21
22sbindir = @sbindir@
23sysconfdir = @sysconfdir@
24localstatedir = @localstatedir@
25mandir = @mandir@
26
27configfile = @myconffile@
28mydatafile = @mydatafile@
29mylockfile = @mylockfile@
30mylogfile = @mylogfile@
31
32mydatadir = @mydataroot@
33mylogdir = @mylogdir@
34mylockdir = @mylockdir@
35
36selectconfig = @selectconfig@
37
38top_builddir = .
39
40INSTALL = @INSTALL@
41INSTALL_PROGRAM = @INSTALL@ -s -m 700
42INSTALL_SHELL = @INSTALL@ -m 700
43INSTALL_DATA = @INSTALL@ -m 600
44INSTALL_MAN = @INSTALL@ -m 644
45INSTALL_SCRIPT = @INSTALL_SCRIPT@
46INSTALL_NAME = @install_name@
47INSTALL_DSYS = @INSTALL@ -m 755
48
49PACKAGE = @PACKAGE@
50VERSION = @VERSION@
51
52VFLAG = @mytclient@
53SETPWD = @setpwd_prg@
54STEGIN = @stegin_prg@
55SAMHAIN = @sh_main_prg@
56YULECTL = @yulectl_prg@
57XOR_CODE = @xor_code@
58SH_LKM = @sh_lkm@
59
60ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
61mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
62
63
64CC = @CC@
65DBGDEF = @mydebugdef@
66DEFS = $(DBGDEF) @DEFS@ -I. -I$(top_srcdir)/include
67CPPFLAGS = @CPPFLAGS@
68LDFLAGS = @LDFLAGS@
69LIBS_TRY = @LIBS@
70LIBS_SOCK = @sh_libsocket@
71LIBS_KVM = @sh_libkvm@
72CFLAGS = @CFLAGS@
73COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
74LINK = $(CC) $(DBGDEF) -O $(LDFLAGS) -o $@
75
76DESTDIR =
77
78TAR = tar
79GZIP = --best
80
81# For creating a packed client
82#
83CLIENTPASSWD =
84
85.SUFFIXES: # Delete the default suffixes
86
87#
88# --- Files -------
89#
90
91
92HEADERS = samhain.h sh_unix.h sh_utils.h sh_error.h sh_error_min.h sh_files.h \
93 sh_getopt.h sh_readconf.h sh_tiger.h sh_hash.h sh_mail.h \
94 sh_mem.h sh_entropy.h sh_forward.h sh_modules.h sh_utmp.h \
95 sh_kern.h sh_suidchk.h sh_srp.h sh_fifo.h sh_html.h sh_tools.h \
96 sh_gpg.h sh_cat.h sh_calls.h sh_extern.h sh_database.h sh_trace.h \
97 sh_schedule.h bignum.h trustfile.h slib.h zAVLTree.h \
98 lzoconf.h minilzo.h rijndael-alg-fst.h rijndael-api-fst.h \
99 rijndael-boxes-fst.h sh_socket.h sh_ignore.h sh_prelude.h \
100 sh_mounts.h sh_userfiles.h sh_static.h sh_prelink.h
101
102
103SOURCES = $(srcsrc)/samhain.c $(srcsrc)/sh_unix.c \
104 $(srcsrc)/sh_utils.c $(srcsrc)/sh_error.c \
105 $(srcsrc)/sh_files.c $(srcsrc)/sh_getopt.c \
106 $(srcsrc)/sh_readconf.c $(srcsrc)/sh_tiger0.c \
107 $(srcsrc)/sh_tiger1.c $(srcsrc)/sh_tiger2.c \
108 $(srcsrc)/sh_tiger1_64.c $(srcsrc)/sh_tiger2_64.c \
109 $(srcsrc)/sh_hash.c $(srcsrc)/sh_mail.c \
110 $(srcsrc)/sh_mem.c $(srcsrc)/sh_entropy.c \
111 $(srcsrc)/sh_forward.c $(srcsrc)/sh_modules.c \
112 $(srcsrc)/sh_utmp.c $(srcsrc)/sh_kern.c \
113 $(srcsrc)/sh_suidchk.c $(srcsrc)/sh_srp.c \
114 $(srcsrc)/sh_fifo.c $(srcsrc)/sh_tools.c \
115 $(srcsrc)/sh_html.c $(srcsrc)/sh_gpg.c \
116 $(srcsrc)/sh_cat.c $(srcsrc)/sh_calls.c \
117 $(srcsrc)/sh_extern.c $(srcsrc)/sh_database.c \
118 $(srcsrc)/sh_err_log.c $(srcsrc)/sh_err_console.c \
119 $(srcsrc)/sh_err_syslog.c $(srcsrc)/sh_schedule.c \
120 $(srcsrc)/bignum.c $(srcsrc)/mkhdr.c \
121 $(srcsrc)/samhain_setpwd.c $(srcsrc)/samhain_stealth.c \
122 $(srcsrc)/encode.c $(srcsrc)/sstrip.c \
123 $(srcsrc)/trustfile.c $(srcsrc)/exepack.c \
124 $(srcsrc)/exepack_fill.c $(srcsrc)/exepack_mkdata.c \
125 $(srcsrc)/minilzo.c $(srcsrc)/slib.c \
126 $(srcsrc)/rijndael-alg-fst.c $(srcsrc)/rijndael-api-fst.c \
127 $(srcsrc)/zAVLTree.c $(srcsrc)/bignum.c \
128 $(srcsrc)/sh_socket.c $(srcsrc)/sh_ignore.c \
129 $(srcsrc)/yulectl.c $(srcsrc)/sh_mounts.c \
130 $(srcsrc)/sh_userfiles.c $(srcsrc)/sh_prelude.c \
131 $(srcsrc)/sh_prelink.c $(srcsrc)/sh_static.c \
132 $(srcsrc)/sh_prelude_old.c
133
134OBJECTS = samhain.o sh_unix.o sh_utils.o sh_error.o sh_files.o \
135 sh_getopt.o sh_readconf.o sh_tiger0.o sh_tiger1.o sh_tiger2.o \
136 sh_tiger1_64.o sh_tiger2_64.o sh_hash.o sh_mail.o sh_mem.o \
137 sh_entropy.o sh_forward.o sh_modules.o sh_utmp.o sh_kern.o \
138 sh_suidchk.o sh_srp.o sh_fifo.o sh_tools.o sh_html.o sh_gpg.o \
139 sh_cat.o sh_calls.o sh_extern.o sh_database.o sh_err_log.o \
140 sh_err_console.o sh_err_syslog.o sh_schedule.o bignum.o \
141 trustfile.o rijndael-alg-fst.o rijndael-api-fst.o slib.o \
142 zAVLTree.o sh_socket.o sh_ignore.o sh_prelude.o \
143 sh_mounts.o sh_userfiles.o sh_prelink.o sh_static.o sh_prelude_old.o
144
145KERN = kern_head.h kern_head.c
146
147TESTSUITE = test.sh testcompile.sh testhash.sh testtiger.txt \
148 testtimesrv.sh \
149 testext.sh testrc_1ext.in test_ext.c.in \
150 testrun_1.sh testrun_1a.sh testrun_1b.sh testrc_1 \
151 testrun_2.sh testrun_2a.sh testrun_2b.sh testrc_2.in \
152 testrun_2c.sh testrun_2d.sh
153
154DIST_COMMON = README COPYING LICENSE samhain.jpg \
155samhainrc.linux samhainrc.solaris samhainrc.freebsd samhainrc.aix5.2.0 \
156yulerc.template \
157Install.sh
158
159DIST_NEEDED = Makefile.in deploy.sh.in samhain-install.sh.in \
160samhain.spec.in rules.deb.in rules.deb-light.in samhain.spec hp_ux.psf.in \
161stealth_template.jpg \
162config.guess config.h.in stamp-h.in config.sub configure \
163configure.ac acconfig.h aclocal.m4 install-sh missing mkinstalldirs \
164c_random.sh c_bits.sh depend.sum depend.dep stamp-hdep
165
166DISTFILES = $(DIST_COMMON) $(DIST_NEEDED) \
167 src include man scripts init docs sql_init test dsys
168
169PROGRAMS = $(SETPWD) $(STEGIN) $(SAMHAIN) $(YULECTL)
170
171#----------------------------------------------------------
172#
173# the first target is the default one
174#
175#----------------------------------------------------------
176
177all: $(top_srcdir)/depend.sum $(SETPWD) $(STEGIN) $(SAMHAIN) $(YULECTL) @sh_lkm@ sstrip
178
179
180#----------------------------------------------------------
181#
182# rules for automatic updating of configuration information
183# after changing the configuration files
184#
185#----------------------------------------------------------
186
187$(top_srcdir)/configure: $(top_srcdir)/configure.ac $(top_srcdir)/aclocal.m4
188 cd $(srcdir) && autoconf
189
190# autoheader might not change config.h.in, so touch a stamp file.
191$(top_srcdir)/config.h.in: $(top_srcdir)/stamp-h.in
192 touch $(top_srcdir)/config.h.in
193
194$(top_srcdir)/stamp-h.in: $(top_srcdir)/configure.ac $(top_srcdir)/aclocal.m4
195 cd $(top_srcdir) && autoheader
196 echo timestamp > $(top_srcdir)/stamp-h.in
197
198config.h: stamp-h
199 @sleep 1; \
200 touch config.h
201
202stamp-h: $(top_srcdir)/config.h.in config.status
203 ./config.status
204
205Makefile: $(top_srcdir)/Makefile.in config.status
206 ./config.status
207
208samhain-install.sh: $(top_srcdir)/samhain-install.sh.in config.status
209 ./config.status
210
211config.status: $(top_srcdir)/configure
212 ./config.status --recheck
213
214#----------------------------------------------------------
215#
216# rules for automatic dependency tracking
217#
218#----------------------------------------------------------
219
220
221depend-gen: $(srcsrc)/depend-gen.c
222 @echo "$(CC) $(CFLAGS) -o depend-gen $(srcsrc)/depend-gen.c"; \
223 $(CC) $(CFLAGS) -o depend-gen $(srcsrc)/depend-gen.c 2>/dev/null || \
224 echo "failed to compile ... hope depend.dep is ok"
225
226# redo if sources change
227#
228$(top_srcdir)/depend.dep: depend-gen $(SOURCES)
229 @echo "update depend.dep ..."; \
230 test -f $(srcdir)/depend.dep || echo > $(srcdir)/depend.dep; \
231 if test -f depend-gen; then \
232 failfiles=""; \
233 for ff in $(SOURCES) $(srcsrc)/kern_head.c; do \
234 ./depend-gen -i '$$(srcinc)/' -o $(top_srcdir)/depend.dep $$ff || \
235 failfiles="$${failfiles} $$ff"; \
236 done; \
237 if test x"$${failfiles}" != x; then \
238 echo "--------------------------------------------------------";\
239 echo " depend-gen failed to update depend.dep. You can safely"; \
240 echo " ignore this error, unless you have modified the source"; \
241 echo " files and changed their dependencies."; \
242 echo "--------------------------------------------------------";\
243 else \
244 echo $(srcsrc) > $(top_srcdir)/stamp-dep; \
245 fi; \
246 else \
247 echo "depend-gen not found ... depend.dep not modified"; \
248 fi
249
250# only updated if depencies change
251#
252$(top_srcdir)/depend.sum: $(top_srcdir)/depend.dep
253 @if test -f depend-gen; then \
254 nsum=`./depend-gen -c $(top_srcdir)/depend.dep|awk '{print $$1}'`; \
255 osum=`cat $(top_srcdir)/depend.sum 2>/dev/null`; \
256 if test "x$$osum" != "x$$nsum"; then \
257 echo "update $(top_srcdir)/depend.sum ..."; \
258 echo $$nsum > $(top_srcdir)/depend.sum; \
259 echo timestamp > $(top_srcdir)/stamp-hdep; \
260 fi; \
261 fi;
262
263$(top_srcdir)/Makefile.in: $(top_srcdir)/stamp-hdep
264 @echo "update Makefile.in ..."; \
265 echo "cp Makefile.in Makefile.in.bak"; \
266 cp $(top_srcdir)/Makefile.in $(top_srcdir)/Makefile.in.bak; \
267 if test -f depend-gen; then \
268 failfiles=""; \
269 for ff in $(SOURCES) $(srcsrc)/kern_head.c; do \
270 ./depend-gen -i '$$(srcinc)/' -o $(top_srcdir)/Makefile.in $$ff || \
271 failfiles="$${failfiles} $$ff"; \
272 done; \
273 if test x"$${failfiles}" != x; then \
274 echo "--------------------------------------------------------";\
275 echo " depend-gen failed to update Makefile.in. You can safely"; \
276 echo " ignore this error, unless you have modified the source"; \
277 echo " files and changed their dependencies."; \
278 echo "--------------------------------------------------------";\
279 else \
280 echo $(srcsrc) > $(top_srcdir)/stamp-dep; \
281 fi; \
282 fi
283
284# do it manually
285#
286depend: depend-gen
287 @echo "update Makefile.in ..."; \
288 for ff in $(SOURCES) $(srcsrc)/kern_head.c; do \
289 ./depend-gen -i '$$(srcinc)/' -o $(top_srcdir)/Makefile.in $$ff; \
290 echo $(srcsrc) > $(top_srcdir)/stamp-dep; \
291 done
292
293
294#----------------------------------------------------------
295#
296# CLEAN rules
297#
298#----------------------------------------------------------
299
300
301# everything created by make
302#
303
304CLEANFILES = encode config_xor.h depend-gen sh_ks.h sh_ks_xor.h kern_head \
305 internal.h sh_MK.h trustfile sstrip samhain mkhdr encode \
306 yule samhain_setpwd samhain_stealth samhainrc yulectl samhain_hide.ko
307
308clean:
309 -rm -f core *.o
310 @-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
311
312
313# everything created by (./configure && make)
314#
315
316DISTCLEANFILES = Makefile samhain.spec sh_gpg_checksum.h sh_gpg_fp.h \
317 init/samhain.startLinux init/samhain.startGentoo \
318 init/samhain.startLSB init/samhain.startFreeBSD \
319 init/samhain.startSolaris init/samhain.startHPUX \
320 init/samhain.startIRIX \
321 deploy.sh sh_MK.h samhain-install.sh sh_gpg_chksum.h sh_gpg_fp.h \
322 rules.deb rules.deb-light \
323 scripts/samhainadmin.pl scripts/check_samhain.pl \
324 scripts/samhain.ebuild scripts/samhain.ebuild-light
325
326TESTCLEANFILES = samhain.build samhain.new yule.html \
327 test_ext test_ext.c test_ext.res test_log testhash.tmp \
328 testrc1.signed testrc_1ext testrc_2 testrc_2.signed
329
330distclean: clean
331 -rm -f config.status config.log configure.lineno config.h config.cache
332 @-test -z "$(TESTCLEANFILES)" || rm -f $(TESTCLEANFILES)
333 @-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
334
335
336#----------------------------------------------------------
337#
338# TEST rules
339#
340#----------------------------------------------------------
341
342test14: test
343 @cd test && TOP_SRCDIR=$(top_srcdir) && \
344 export TOP_SRCDIR && ./test.sh 14 `hostname -f`
345
346test13: test
347 @cd test && TOP_SRCDIR=$(top_srcdir) && \
348 export TOP_SRCDIR && ./test.sh 13 `hostname -f`
349
350test12: test
351 @cd test && TOP_SRCDIR=$(top_srcdir) && \
352 export TOP_SRCDIR && ./test.sh 12 `hostname -f`
353
354test11: test
355 @cd test && TOP_SRCDIR=$(top_srcdir) && \
356 export TOP_SRCDIR && ./test.sh 11 `hostname -f`
357
358test10: test
359 @cd test && TOP_SRCDIR=$(top_srcdir) && \
360 export TOP_SRCDIR && ./test.sh 10 `hostname -f`
361
362test7: test
363 @cd test && TOP_SRCDIR=$(top_srcdir) && \
364 export TOP_SRCDIR && ./test.sh 7
365
366test6: test
367 @cd test && TOP_SRCDIR=$(top_srcdir) && \
368 export TOP_SRCDIR && ./test.sh 6
369
370test5: test
371 @cd test && TOP_SRCDIR=$(top_srcdir) && \
372 export TOP_SRCDIR && ./test.sh 5
373
374test4: test
375 @cd test && TOP_SRCDIR=$(top_srcdir) && \
376 export TOP_SRCDIR && ./test.sh 4
377
378test3: test
379 @cd test && TOP_SRCDIR=$(top_srcdir) && \
380 export TOP_SRCDIR && ./test.sh 3
381
382test2: test
383 @cd test && TOP_SRCDIR=$(top_srcdir) && \
384 export TOP_SRCDIR && ./test.sh 2
385
386test1: test
387 @cd test && TOP_SRCDIR=$(top_srcdir) && \
388 export TOP_SRCDIR && ./test.sh 1
389
390test:
391 @if test -f test; then \
392 :; \
393 else \
394 cp -pr $(top_srcdir)/test .; \
395 cat $(top_srcdir)/test/test.sh | \
396 sed 's%XXXSRCXXX%$(top_srcdir)%' > test/test.sh; \
397 chmod +x test/test.sh; \
398 fi
399
400#----------------------------------------------------------
401#
402# INSTALL rules
403#
404#----------------------------------------------------------
405
406install: install-lkm install-program install-man install-data
407 @echo; \
408 echo " You can use 'samhain-install.sh uninstall' for uninstalling"; \
409 echo " i.e. you might consider saving that script for future use";\
410 echo; \
411 echo " Use 'make install-boot' if you want @install_name@ to start on system boot"; \
412 echo
413
414install-light: install-lkm install-program install-data
415 @echo; \
416 echo " You can use 'samhain-install.sh uninstall' for uninstalling"; \
417 echo " i.e. you might consider saving that script for future use";\
418 echo; \
419 echo " Use 'make install-boot' if you want @install_name@ to start on system boot"; \
420 echo
421
422purge: uninstall-lkm uninstall-program uninstall-man
423 @echo "./samhain-install.sh --destdir=$(DESTDIR) --force --verbose uninstall-data"; \
424 ./samhain-install.sh --destdir=$(DESTDIR) --force --verbose uninstall-data
425
426remove: uninstall
427
428uninstall: uninstall-lkm uninstall-program uninstall-man uninstall-data
429 @echo; \
430 echo " Use 'make purge' if you also want to uninstall the configuration file"; \
431 echo " Use 'make uninstall-boot' to uninstall the runlevel scripts"; \
432 echo
433
434#
435# --- boot ---
436#
437install-boot: samhain-install.sh
438 ./samhain-install.sh --destdir=$(DESTDIR) --express --verbose install-boot
439
440
441uninstall-boot: samhain-install.sh
442 ./samhain-install.sh --destdir=$(DESTDIR) --express --verbose uninstall-boot
443
444#
445# --- program ---
446#
447
448# -- NEW --
449install-lkm: @sh_lkm@
450 @RVER=`uname -r`; \
451 if test "x@sh_lkm@" != "x"; then \
452 if test -d /lib/modules/$$RVER; then \
453 MODDIR="/lib/modules/$$RVER"; \
454 elif test -d /lib/modules/misc; then \
455 MODDIR="/lib/modules/misc"; \
456 elif test -d /lib/modules; then \
457 MODDIR="/lib/modules/misc"; \
458 fi; \
459 $(mkinstalldirs) $(DESTDIR)$${MODDIR}; \
460 list='@sh_lkm@'; for p in $$list; do \
461 echo " cp $$p $(DESTDIR)$${MODDIR}/`echo $$p|sed 's%samhain%@install_name@%'`"; \
462 cp $$p $(DESTDIR)$${MODDIR}/`echo $$p|sed 's%samhain%@install_name@%'` ; \
463 chown root $(DESTDIR)$${MODDIR}/`echo $$p|sed 's%samhain%@install_name@%'`; \
464 done; \
465 if test "x$(DESTDIR)" = x; then \
466 echo " depmod -a || /sbin/depmod -a"; \
467 depmod -a || /sbin/depmod -a; \
468 fi; \
469 fi
470
471uninstall-lkm:
472 @echo "./samhain-install.sh --destdir=$(DESTDIR) --express --verbose uninstall-lkm";\
473 ./samhain-install.sh --destdir=$(DESTDIR) --express --verbose uninstall-lkm
474
475
476install-program: $(PROGRAMS) sstrip
477 @$(mkinstalldirs) $(DESTDIR)$(sbindir)
478 @list='$(PROGRAMS)'; for p in $$list; do \
479 if test -f $$p; then \
480 echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's%samhain%@install_name@%'|sed 's%yule%@install_name@%'`"; \
481 $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's%samhain%@install_name@%'|sed 's%yule%@install_name@%'`; \
482 echo " ./sstrip $(DESTDIR)$(sbindir)/`echo $$p|sed 's%samhain%@install_name@%'|sed 's%yule%@install_name@%'`"; \
483 ./sstrip $(DESTDIR)$(sbindir)/`echo $$p|sed 's%samhain%@install_name@%'|sed 's%yule%@install_name@%'`; \
484 else :; fi; \
485 done
486
487uninstall-program:
488 @echo "./samhain-install.sh --destdir=$(DESTDIR) --express --verbose uninstall-program";\
489 ./samhain-install.sh --destdir=$(DESTDIR) --express --verbose uninstall-program
490
491
492#
493# -- data files
494#
495
496install-user:
497 @if test "x@need_user_install@" = x1; then \
498 echo "./samhain-install.sh --destdir=$(DESTDIR) --express --verbose install-user @myident@"; \
499 ./samhain-install.sh --destdir=$(DESTDIR) --express --verbose install-user @myident@; \
500 fi
501 @if test x"$(VFLAG)" = "x-DSH_WITH_SERVER"; then \
502 echo " chown root $(DESTDIR)$(mydatadir)"; \
503 chown root $(DESTDIR)$(mydatadir); \
504 echo " chmod 755 $(DESTDIR)$(mydatadir)"; \
505 chmod 755 $(DESTDIR)$(mydatadir); \
506 echo " chown @myident@ $(DESTDIR)$(configfile)"; \
507 chown @myident@ $(DESTDIR)$(configfile); \
508 if test x"$(mylogdir)" = "x/var/log"; then \
509 if test x"@myident@" = xroot; then \
510 :; \
511 else \
512 echo; \
513 echo " ----------------------------------------------------------------"; \
514 echo " Directory $(mylogdir) (log file) looks like a system directory."; \
515 echo " You may run into problems (need write access for user @myident@)."; \
516 echo " ----------------------------------------------------------------"; \
517 echo; \
518 fi; \
519 else \
520 echo " chown @myident@ $(DESTDIR)$(mylogdir)"; \
521 chown @myident@ $(DESTDIR)$(mylogdir); \
522 fi; \
523 fi
524
525install-data: trustfile
526 @$(mkinstalldirs) $(DESTDIR)$(sysconfdir)
527 @$(mkinstalldirs) $(DESTDIR)$(mylockdir)
528 @$(mkinstalldirs) $(DESTDIR)$(mylogdir)
529 @$(mkinstalldirs) $(DESTDIR)$(mydatadir); \
530 chmod 700 $(DESTDIR)$(mydatadir)
531 @if test -f samhainrc.$(selectconfig); then \
532 :; \
533 else \
534 if test -f $(srcdir)/samhainrc.$(selectconfig); then \
535 cp $(srcdir)/samhainrc.$(selectconfig) . ; \
536 fi; \
537 fi; \
538 if test -f yulerc; then \
539 :; \
540 else \
541 if test -f $(srcdir)/yulerc.template; then \
542 cp $(srcdir)/yulerc.template yulerc; \
543 fi; \
544 fi; \
545 if test -f stealth_template.jpg; then \
546 :; \
547 else \
548 if test -f $(srcdir)/stealth_template.jpg; then \
549 cp $(srcdir)/stealth_template.jpg . ; \
550 fi; \
551 fi
552 @echo "./samhain-install.sh --destdir=$(DESTDIR) --express --verbose install-data"; \
553 ./samhain-install.sh --destdir=$(DESTDIR) --express --verbose install-data || \
554 echo " ERROR: Failed to install the configuration file to $(DESTDIR)$(configfile). You need to install the configuration file manually."
555 @if test x"$(VFLAG)" = "x-DSH_WITH_SERVER"; then \
556 echo;\
557 echo " -----------------------------------------------------";\
558 echo " The server will run as user @myident@ if started with";\
559 echo " root privileges, otherwise as the user of the parent ";\
560 echo " process (use --enable-identity=USER to change).";\
561 echo;\
562 echo " You may want to use: make install-user";\
563 echo;\
564 echo " - to add the user @myident@ (if not existing already)";\
565 echo " - to chown the data directory $(mydatadir)";\
566 echo " - to chown the log file directory $(mylogdir)";\
567 echo " - to chown the configuration file $(configfile)";\
568 echo " -----------------------------------------------------";\
569 else \
570 if test "x@need_user_install@" = x1; then \
571 echo;\
572 echo " -----------------------------------------------------";\
573 echo " You may want to use: make install-user";\
574 echo;\
575 echo " - to add the user @myident@ (if not existing already)";\
576 echo " -----------------------------------------------------";\
577 fi; \
578 fi
579
580uninstall-data:
581 @echo "./samhain-install.sh --destdir=$(DESTDIR) --express --verbose uninstall-data"; \
582 ./samhain-install.sh --destdir=$(DESTDIR) --express --verbose uninstall-data
583
584#
585# -- man files
586#
587
588install-man:
589 $(mkinstalldirs) $(DESTDIR)$(mandir)/man8
590 $(mkinstalldirs) $(DESTDIR)$(mandir)/man5
591 @if test -f $(top_srcdir)/man/samhain.8 ; then \
592 echo " $(INSTALL_MAN) $(top_srcdir)/man/samhain.8 $(DESTDIR)$(mandir)/man8/@install_name@.8"; \
593 $(INSTALL_MAN) $(top_srcdir)/man/samhain.8 $(DESTDIR)$(mandir)/man8/@install_name@.8; \
594 fi
595 @if test -f $(top_srcdir)/man/samhainrc.5 ; then \
596 echo " $(INSTALL_MAN) $(top_srcdir)/man/samhainrc.5 $(DESTDIR)$(mandir)/man5/@install_name@rc.5"; \
597 $(INSTALL_MAN) $(top_srcdir)/man/samhainrc.5 $(DESTDIR)$(mandir)/man5/@install_name@rc.5; \
598 fi
599
600uninstall-man:
601 @echo "./samhain-install.sh --destdir=$(DESTDIR) --express --verbose uninstall-man";\
602 ./samhain-install.sh --destdir=$(DESTDIR) --express --verbose uninstall-man
603
604
605#----------------------------------------------------------
606#
607# BUILD rules
608#
609#----------------------------------------------------------
610
611run: run-light
612
613run-light: all
614 @echo "Building $(PACKAGE)-$(VERSION).run"; \
615 STAGE=$(PACKAGE)-$(VERSION); \
616 mkdir $$STAGE; \
617 if test x"$$?" != x0; then \
618 echo "ERROR ... mkdir $$STAGE failed"; \
619 exit 1; \
620 fi; \
621 make DESTDIR=$$STAGE install-light; \
622 rm -f $$STAGE/@sbindir@/@install_name@_stealth; \
623 echo "#! /bin/sh" > $$STAGE/setup.sh; \
624 echo "./mkinstalldirs @sbindir@ || exit 1" >> $$STAGE/setup.sh; \
625 echo "./mkinstalldirs @sysconfdir@ || exit 1" >> $$STAGE/setup.sh; \
626 echo "./mkinstalldirs @mylockdir@ || exit 1" >> $$STAGE/setup.sh; \
627 echo "./mkinstalldirs @mylogdir@ || exit 1" >> $$STAGE/setup.sh; \
628 echo "./mkinstalldirs @mydataroot@ || exit 1" >> $$STAGE/setup.sh; \
629 echo "chmod 700 @mydataroot@ || exit 1" >> $$STAGE/setup.sh; \
630 if test -f $$STAGE/lib/modules; then \
631 RVER=`uname -r`; \
632 echo "chown root:root lib/modules/$$RVER/*" >> $$STAGE/setup.sh; \
633 if test -d /lib/modules/$$RVER; then \
634 echo "./mkinstalldirs /lib/modules/$$RVER" >> $$STAGE/setup.sh; \
635 echo "cp -p lib/modules/$$RVER/* /lib/modules/$$RVER/" >> $$STAGE/setup.sh; \
636 elif test -d /lib/modules/misc; then \
637 echo "./mkinstalldirs /lib/modules/misc" >> $$STAGE/setup.sh; \
638 echo "cp -p lib/modules/misc/* /lib/modules/misc/" >> $$STAGE/setup.sh; \
639 elif test -d /lib/modules; then \
640 echo "./mkinstalldirs /lib/modules/misc" >> $$STAGE/setup.sh; \
641 echo "cp -p lib/modules/misc/* /lib/modules/misc/" >> $$STAGE/setup.sh; \
642 fi; \
643 echo "/sbin/depmod -a" >> $$STAGE/setup.sh; \
644 fi; \
645 temp=`echo $(sbindir) | sed s,^/,,`; \
646 echo "chown root $$temp/*" >> $$STAGE/setup.sh; \
647 echo "cp -p $$temp/* $(sbindir) || exit 1" >> $$STAGE/setup.sh; \
648 temp=`echo $(sysconfdir) | sed s,^/,,`; \
649 echo "chown root $$temp/*" >> $$STAGE/setup.sh; \
650 configfile=`echo @myconffile@ | sed 's%^REQ_FROM_SERVER%%'`; \
651 echo "test -f $$configfile || cp -p $$temp/* $$configfile" >> $$STAGE/setup.sh; \
652 echo "./samhain-install.sh --express --verbose install-boot" >> $$STAGE/setup.sh; \
653 cp $(top_srcdir)/mkinstalldirs $$STAGE/; \
654 cp $(top_srcdir)/install-sh $$STAGE/; \
655 cp ./samhain-install.sh $$STAGE/; \
656 cp -r init/ $$STAGE/; \
657 chmod +x $$STAGE/setup.sh; \
658 chmod +x $$STAGE/samhain-install.sh; \
659 chmod +x $$STAGE/mkinstalldirs; \
660 chmod +x $$STAGE/install-sh; \
661 $(top_srcdir)/scripts/makeself/makeself.sh --header $(top_srcdir)/scripts/makeself/makeself-header.sh --nocomp --nomd5 --notemp $$STAGE $(PACKAGE)-$(VERSION).run "$(PACKAGE)_$(VERSION)_self_extracting_installer" ./setup.sh && \
662 rm -r $(PACKAGE)-$(VERSION)
663
664emerge-prepare: dist
665 @echo "Building $(PACKAGE)-$(VERSION)"; \
666 test -f /etc/make.globals && . /etc/make.globals; \
667 test -f /etc/make.conf && . /etc/make.conf; \
668 echo "$(INSTALL_MAN) $(PACKAGE)-$(VERSION).tar.gz $${DISTDIR}/@install_name@-$(VERSION).tar.gz"; \
669 $(INSTALL_MAN) $(PACKAGE)-$(VERSION).tar.gz $${DISTDIR}/@install_name@-$(VERSION).tar.gz; \
670 if test "x$${PORTDIR_OVERLAY}" = "x"; then \
671 COPY_TO="$${PORTDIR}"; \
672 else \
673 COPY_TO="$${PORTDIR_OVERLAY}"; \
674 fi; \
675 $(mkinstalldirs) $${COPY_TO}/app-admin/@install_name@; \
676 echo "$(INSTALL_MAN) scripts/samhain.ebuild $${COPY_TO}/app-admin/@install_name@/@install_name@-$(VERSION).ebuild";\
677 $(INSTALL_MAN) scripts/samhain.ebuild $${COPY_TO}/app-admin/@install_name@/@install_name@-$(VERSION).ebuild; \
678 test -f $${COPY_TO}/app-admin/@install_name@/files/digest-@install_name@-$(VERSION) && rm $${COPY_TO}/app-admin/@install_name@/files/digest-@install_name@-$(VERSION);\
679 ebuild $${COPY_TO}/app-admin/@install_name@/@install_name@-$(VERSION).ebuild digest;
680
681emerge-prepare-light: dist
682 @echo "Building $(PACKAGE)-$(VERSION)"; \
683 test -f /etc/make.globals && . /etc/make.globals; \
684 test -f /etc/make.conf && . /etc/make.conf; \
685 echo "$(INSTALL_MAN) $(PACKAGE)-$(VERSION).tar.gz $${DISTDIR}/@install_name@-$(VERSION).tar.gz"; \
686 $(INSTALL_MAN) $(PACKAGE)-$(VERSION).tar.gz $${DISTDIR}/@install_name@-$(VERSION).tar.gz; \
687 if test "x$${PORTDIR_OVERLAY}" = "x"; then \
688 COPY_TO="$${PORTDIR}"; \
689 else \
690 COPY_TO="$${PORTDIR_OVERLAY}"; \
691 fi; \
692 $(mkinstalldirs) $${COPY_TO}/app-admin/@install_name@; \
693 echo "$(INSTALL_MAN) scripts/samhain.ebuild-light $${COPY_TO}/app-admin/@install_name@/@install_name@-$(VERSION).ebuild";\
694 $(INSTALL_MAN) scripts/samhain.ebuild-light $${COPY_TO}/app-admin/@install_name@/@install_name@-$(VERSION).ebuild; \
695 test -f $${COPY_TO}/app-admin/@install_name@/files/digest-@install_name@-$(VERSION) && rm $${COPY_TO}/app-admin/@install_name@/files/digest-@install_name@-$(VERSION);\
696 ebuild $${COPY_TO}/app-admin/@install_name@/@install_name@-$(VERSION).ebuild digest;
697
698
699tbz2: emerge-prepare
700 @emerge --buildpkgonly @install_name@; \
701 test -f /etc/make.globals && . /etc/make.globals; \
702 test -f /etc/make.conf && . /etc/make.conf; \
703 echo; \
704 echo "@install_name@-$(VERSION).tbz2 should be in $${PKGDIR}/All"; \
705 if test -f $${PKGDIR}/All/@install_name@-$(VERSION).tbz2; then \
706 echo "Package $${PKGDIR}/All/@install_name@-$(VERSION).tbz2 built."; \
707 mv $${PKGDIR}/All/@install_name@-$(VERSION).tbz2 $(PACKAGE)-$(VERSION).tbz2; \
708 rm -f $${PKGDIR}/app-admin/@install_name@-$(VERSION).tbz2; \
709 rm -rf $${PORTAGE_TMPDIR}/portage/@install_name@-$(VERSION); \
710 else \
711 echo "Error ... cannot find package."; \
712 exit 1; \
713 fi; \
714 echo
715
716tbz2-light: emerge-prepare-light
717 @emerge --buildpkgonly @install_name@; \
718 test -f /etc/make.globals && . /etc/make.globals; \
719 test -f /etc/make.conf && . /etc/make.conf; \
720 echo; \
721 if test -f $${PKGDIR}/All/@install_name@-$(VERSION).tbz2; then \
722 echo "Package $${PKGDIR}/All/@install_name@-$(VERSION).tbz2 built."; \
723 mv $${PKGDIR}/All/@install_name@-$(VERSION).tbz2 $(PACKAGE)-$(VERSION).tbz2; \
724 rm -f $${PKGDIR}/app-admin/@install_name@-$(VERSION).tbz2; \
725 rm -rf $${PORTAGE_TMPDIR}/portage/@install_name@-$(VERSION); \
726 else \
727 echo "Error ... cannot find package."; \
728 exit 1; \
729 fi; \
730 echo
731
732emerge:
733 emerge $(PACKAGE);
734
735deb-light:
736 @echo "creating subdirectory debian"; \
737 mkdir -p debian; \
738 cp rules.deb-light debian/rules; \
739 chmod +x debian/rules; \
740 echo $(sbindir) | sed s,^/,, > debian/dirs; \
741 echo $(sysconfdir) | sed s,^/,, >> debian/dirs; \
742 echo etc/init.d >> debian/dirs; \
743 echo $(mydatadir) | sed s,^/,, >> debian/dirs; \
744 echo $(mylogdir) | sed s,^/,, >> debian/dirs; \
745 echo $(mylockdir) | sed s,^/,, >> debian/dirs; \
746 if test "x@sh_lkm@" != x; then \
747 RVER=`uname -r`; \
748 if test -d /lib/modules/$$RVER; then \
749 echo "lib/modules/$$RVER" >> debian/dirs; \
750 elif test -d /lib/modules/misc; then \
751 echo "lib/modules/misc" >> debian/dirs; \
752 elif test -d /lib/modules; then \
753 echo "lib/modules/misc" >> debian/dirs; \
754 fi; \
755 fi; \
756 $(MAKE) deb-run
757
758deb:
759 @echo "creating subdirectory debian"; \
760 mkdir -p debian; \
761 cp rules.deb debian/rules; \
762 chmod +x debian/rules; \
763 echo $(sbindir) | sed s,^/,, > debian/dirs; \
764 echo $(sysconfdir) | sed s,^/,, >> debian/dirs; \
765 echo etc/init.d >> debian/dirs; \
766 echo $(mydatadir) | sed s,^/,, >> debian/dirs; \
767 echo $(mylogdir) | sed s,^/,, >> debian/dirs; \
768 echo $(mylockdir) | sed s,^/,, >> debian/dirs; \
769 echo $(mandir)/man5 | sed s,^/,, >> debian/dirs; \
770 echo $(mandir)/man8 | sed s,^/,, >> debian/dirs; \
771 echo usr/share/doc/$(PACKAGE) >> debian/dirs; \
772 if test "x@sh_lkm@" != x; then \
773 RVER=`uname -r`; \
774 if test -d /lib/modules/$$RVER; then \
775 echo "lib/modules/$$RVER" >> debian/dirs; \
776 elif test -d /lib/modules/misc; then \
777 echo "lib/modules/misc" >> debian/dirs; \
778 elif test -d /lib/modules; then \
779 echo "lib/modules/misc" >> debian/dirs; \
780 fi; \
781 fi; \
782 echo $(top_srcdir)/README > debian/docs; \
783 echo $(top_srcdir)/test/testtiger.txt >> debian/docs; \
784 echo $(srcsrc)/simple-bignum.tar.bz2 >> debian/docs; \
785 echo $(top_srcdir)/scripts/head.html >> debian/docs; \
786 echo $(top_srcdir)/scripts/foot.html >> debian/docs; \
787 echo $(top_srcdir)/samhain.jpg >> debian/docs; \
788 echo $(top_srcdir)/docs/BUGS >> debian/docs; \
789 echo $(top_srcdir)/docs/HOWTO-client+server.html >> debian/docs; \
790 echo $(top_srcdir)/docs/HOWTO-samhain+GnuPG.html >> debian/docs; \
791 echo $(top_srcdir)/docs/MANUAL-2_0.html.tar >> debian/docs; \
792 echo $(top_srcdir)/docs/MANUAL-2_0.ps >> debian/docs; \
793 echo $(top_srcdir)/docs/README.gcc_bug >> debian/docs; \
794 echo $(top_srcdir)/docs/README.LZO >> debian/docs; \
795 echo $(top_srcdir)/docs/README.sstrip >> debian/docs; \
796 echo $(top_srcdir)/docs/README.UPGRADE >> debian/docs; \
797 echo $(top_srcdir)/docs/README.win2K >> debian/docs; \
798 echo $(top_srcdir)/docs/TODO >> debian/docs; \
799 $(MAKE) deb-run
800
801deb-run:
802 @maintainer=`gpg --list-secret-keys | grep 'sec ' | cut -d" " -f 5-`;\
803 if test "x$$maintainer" = x; then \
804 maintainer="Nobody Nowhere <nobody@example.com>"; \
805 fi; \
806 echo "$(PACKAGE) ($(VERSION)-1) stable; urgency=low" > debian/changelog; \
807 echo >> debian/changelog; \
808 echo " * Initial release." >> debian/changelog; \
809 echo >> debian/changelog; \
810 echo " -- $$maintainer `date -R`" >> debian/changelog; \
811 echo >> debian/changelog; \
812 echo "Local variables:" >> debian/changelog; \
813 echo "mode: debian-changelog" >> debian/changelog; \
814 echo "End:" >> debian/changelog; \
815 cp $(top_srcdir)/COPYING debian/copyright; \
816 touch debian/README.debian; \
817 echo "Document: @install_name@-manual" > debian/@install_name@.doc-base; \
818 echo "Title: @install_name@ Manual" >> debian/@install_name@.doc-base; \
819 echo "Author: Rainer Wichmann" >> debian/@install_name@.doc-base; \
820 echo "Abstract: This manual describes what @install_name@ is" >> debian/@install_name@.doc-base; \
821 echo " and how it can be used to check the file integrity of your" >> debian/@install_name@.doc-base; \
822 echo " server." >> debian/@install_name@.doc-base; \
823 echo "Section: admin" >> debian/@install_name@.doc-base; \
824 echo >> debian/@install_name@.doc-base; \
825 echo >> debian/@install_name@.doc-base; \
826 echo "Format: Postscript" >> debian/@install_name@.doc-base; \
827 echo "Files: /usr/share/doc/@install_name@/manual.ps.gz" >> debian/@install_name@.doc-base; \
828 echo >> debian/@install_name@.doc-base; \
829 echo "Format: HTML" >> debian/@install_name@.doc-base; \
830 echo "Index: /usr/share/doc/@install_name@/manual.html/index.html" >> debian/@install_name@.doc-base; \
831 echo "Files: /usr/share/doc/@install_name@/manual.html/*.html" >> debian/@install_name@.doc-base; \
832 echo $(sysconfdir)/@install_name@rc > debian/conffiles; \
833 echo /etc/init.d/@install_name@ >> debian/conffiles; \
834 cp init/samhain.startLinux debian/@install_name@.init; \
835 echo "Source: samhain" > debian/control; \
836 echo "Section: admin" >> debian/control; \
837 echo "Priority: optional" >> debian/control; \
838 echo "Maintainer: $$maintainer" >> debian/control; \
839 echo "Standards-Version: 3.2.1" >> debian/control; \
840 echo >> debian/control; \
841 echo "Package: @install_name@" >> debian/control; \
842 echo "Architecture: any" >> debian/control; \
843 echo "Depends: \$${shlibs:Depends}" >> debian/control; \
844 echo "Description: File integrity checker" >> debian/control; \
845 echo " A file integrity checker" >> debian/control; \
846 echo "running debuild -us -uc"; \
847 debuild -us -uc; \
848 DEBFILE=`find ../ -follow -maxdepth 1 -cnewer ./debian/control 2>/dev/null | grep '@install_name@_$(VERSION)' | grep '\.deb'`; \
849 if test x"$$DEBFILE" = x; then \
850 echo "Error ... cannot find package file"; \
851 exit 1; \
852 else \
853 echo "Package $$DEBFILE built."; \
854 cp $$DEBFILE ./$(PACKAGE)-$(VERSION).deb; \
855 fi; \
856 echo
857
858#
859# Check samhain.spec
860#
861rpmspec-full:
862 @grep 'install-light' samhain.spec >/dev/null 2>&1; \
863 if test x"$$?" = "x0"; then \
864 echo "Your samhain.spec is from rpm-light. Please run"; \
865 echo " .config.status to re-create the original samhain.spec"; \
866 exit 1; \
867 fi
868
869# when editing the spec file, make an additional blank after 'make'
870# to avoid that it matches on a second processing
871#
872rpmspec-light: samhain.spec
873 @echo "Stripping docs from samhain.spec"; \
874 cat samhain.spec | sed 's,make DESTDIR=$${RPM_BUILD_ROOT} install,make DESTDIR=$${RPM_BUILD_ROOT} install-light,' | sed s,shkeep=yes,shkeep=no, | sed s,%doc.*,, | sed s,%attr.*,, > samhain.spec-light; \
875 mv samhain.spec-light samhain.spec
876
877rpm-light: rpmspec-light distrpm
878 rpmbuild -ta ./$(PACKAGE)-$(VERSION).tar.gz;
879 @echo "Searching the RPM package ..."; \
880 RPMFILE=`find /usr/src -follow -maxdepth 4 -cnewer ./samhain.spec 2>/dev/null | grep '@install_name@-$(VERSION)' | grep '\.rpm' | grep -v '\.src\.'`; \
881 echo; \
882 if test x"$$RPMFILE" = x; then \
883 echo "Error ... cannot find package file"; \
884 exit 1; \
885 else \
886 echo "Package $$RPMFILE built."; \
887 cp $$RPMFILE ./$(PACKAGE)-$(VERSION).rpm; \
888 fi; \
889 echo
890
891rpm: rpmspec-full distrpm
892 rpmbuild -ta ./$(PACKAGE)-$(VERSION).tar.gz;
893 @echo "Searching the RPM package ..."; \
894 RPMFILE=`find /usr/src -follow -maxdepth 4 -cnewer ./samhain.spec 2>/dev/null | grep '@install_name@-$(VERSION)' | grep '\.rpm' | grep -v '\.src\.'`; \
895 echo; \
896 if test x"$$RPMFILE" = x; then \
897 echo "Error ... cannot find package file"; \
898 exit 1; \
899 else \
900 echo "Package $$RPMFILE built."; \
901 cp $$RPMFILE ./$(PACKAGE)-$(VERSION).rpm; \
902 fi; \
903 echo
904
905srpm-dist: rpmspec-full samhain.spec
906 @cat samhain.spec | \
907 sed s%\-\-with\-base=.*\,[0123456789]*%% | \
908 sed s%\'\'%% > samhain.spec.m; \
909 mv samhain.spec.m samhain.spec
910 $(MAKE) distrpm
911 rpmbuild -ts ./$(PACKAGE)-$(VERSION).tar.gz
912
913
914srpm: rpmspec-full distrpm
915 rpmbuild -ts ./$(PACKAGE)-$(VERSION).tar.gz
916
917solaris-pkg-light: all
918 @STAGE=/tmp/samhain-pkg-staging; \
919 mkdir $$STAGE; \
920 if test x"$$?" != x0; then \
921 echo "ERROR ... mkdir $$STAGE failed"; \
922 exit 1; \
923 fi; \
924 make DESTDIR=$$STAGE install-light;
925 $(MAKE) solaris-pkg-finish
926
927solaris-pkg: all
928 @STAGE=/tmp/samhain-pkg-staging; \
929 mkdir $$STAGE; \
930 if test x"$$?" != x0; then \
931 echo "ERROR ... mkdir $$STAGE failed"; \
932 exit 1; \
933 fi; \
934 make DESTDIR=$$STAGE install;
935 $(MAKE) solaris-pkg-finish
936
937solaris-pkg-finish:
938 @STAGE=/tmp/samhain-pkg-staging; \
939 $(mkinstalldirs) $$STAGE/etc/init.d; \
940 $(INSTALL_SHELL) init/samhain.startSolaris $$STAGE/etc/init.d/@install_name@; \
941 (echo 'i pkginfo'; pkgproto $$STAGE=/ ) >prototype; \
942 user=`id | sed s,uid=[0123456789]*\(,, | sed s,\).*,,`; \
943 group=`id | sed s,.*gid=[0123456789]*\(,, | sed s,\).*,,`; \
944 cat prototype | grep -v 'none / ' | grep -v 'none /usr ' | \
945 grep -v 'none /usr/local ' | grep -v 'none /usr/bin ' | \
946 grep -v 'none /usr/local/bin ' | grep -v 'none /usr/local/sbin ' | \
947 grep -v 'none /var ' | grep -v 'none /usr/sbin ' | \
948 sed s,$$user\ $$group,root\ sys,g > prototype.1; \
949 rm -f prototype && mv prototype.1 prototype; \
950 echo "d none /var ? ? ?" >> prototype; \
951 echo "d none /etc/rc0.d ? ? ?" >> prototype; \
952 echo "d none /etc/rc1.d ? ? ?" >> prototype; \
953 echo "d none /etc/rc3.d ? ? ?" >> prototype; \
954 echo "l none /etc/rc3.d/S99@install_name@=/etc/init.d/@install_name@" >> prototype; \
955 echo "l none /etc/rc0.d/K10@install_name@=/etc/init.d/@install_name@" >> prototype; \
956 echo "l none /etc/rc1.d/K10@install_name@=/etc/init.d/@install_name@" >> prototype; \
957 ARCH=`uname -p`; \
958 PSTAMP=`date '+%cc%yy%mm%dd%HH%MM%SS'`; \
959 echo "PKG=@install_name@" > pkginfo; \
960 echo "NAME=file integrity check" >> pkginfo; \
961 echo "VERSION=$(VERSION)" >> pkginfo; \
962 echo "CATEGORY=system" >> pkginfo; \
963 echo "CLASSES=none" >> pkginfo; \
964 echo "VENDOR=http://la-samhna.de/samhain" >> pkginfo; \
965 echo "EMAIL=support@la-samhna.de" >> pkginfo; \
966 echo "ARCH=$$ARCH" >> pkginfo; \
967 echo "PSTAMP=$$PSTAMP" >> pkginfo; \
968 pkgmk -o; \
969 pkgtrans -s /var/spool/pkg /tmp/samhain-pkg-staging/@install_name@.pkg @install_name@; \
970 if test -f /tmp/samhain-pkg-staging/@install_name@.pkg; then \
971 echo; \
972 cp /tmp/samhain-pkg-staging/@install_name@.pkg $(PACKAGE)-$(VERSION).pkg; \
973 echo "Package @install_name@.pkg is ready for installation"; \
974 echo; \
975 rm -r /var/spool/pkg/@install_name@ /tmp/samhain-pkg-staging; \
976 else \
977 echo; \
978 echo "Error ... cannot find /tmp/samhain-pkg-staging/@install_name@.pkg."; \
979 echo "Keeping /var/spool/pkg/@install_name@ /tmp/samhain-pkg-staging"; \
980 echo; \
981 exit 1; \
982 fi
983
984depot-prep: all
985 STAGE=/tmp/samhain-pkg-staging; \
986 mkdir $$STAGE; \
987 if test x"$$?" != x0; then \
988 echo "ERROR ... mkdir $$STAGE failed"; \
989 exit 1; \
990 fi; \
991 make DESTDIR=$$STAGE install; \
992 make DESTDIR=$$STAGE install-boot; \
993 cp hp_ux.psf $$STAGE; \
994 mkdir $$STAGE/sc; \
995 echo "#!/sbin/sh" > $$STAGE/sc/configure; \
996 echo "PATH=\$$SW_PATH; export PATH" >> $$STAGE/sc/configure; \
997 echo "chmod 555 /sbin/init.d/samhain; chown bin:bin /sbin/init.d/@install_name@; (cd /sbin; ln -f -s /sbin/init.d/@install_name@ rc2.d/S900@install_name@; ln -f -s /sbin/init.d/@install_name@ rc1.d/K100@install_name@; )" >> $$STAGE/sc/configure; \
998 chmod +x $$STAGE/sc/configure; \
999 echo "#!/sbin/sh" > $$STAGE/sc/unconfigure; \
1000 echo "PATH=\$$SW_PATH; export PATH" >> $$STAGE/sc/unconfigure; \
1001 echo "rm -f /sbin/rc2.d/S900@install_name@; rm -f /sbin/rc1.d/K100@install_name@" >> $$STAGE/sc/unconfigure; \
1002 chmod +x $$STAGE/sc/unconfigure; \
1003 echo "#!/sbin/sh" > $$STAGE/sc/preremove; \
1004 echo "PATH=\$$SW_PATH; export PATH" >> $$STAGE/sc/preremove; \
1005 echo "/sbin/init.d/@install_name@ stop" >> $$STAGE/sc/preremove; \
1006 echo "exit 0" >> $$STAGE/sc/preremove; \
1007 chmod +x $$STAGE/sc/preremove;
1008
1009depot: depot-prep
1010 (cd /tmp/samhain-pkg-staging && /usr/sbin/swpackage -v -s ./hp_ux.psf -x media_type=tape @ $(PACKAGE)-$(VERSION).depot)
1011 cp /tmp/samhain-pkg-staging/$(PACKAGE)-$(VERSION).depot .
1012 rm -rf /tmp/samhain-pkg-staging
1013
1014depot-light: depot
1015
1016#---------------------------------------------------------------
1017
1018
1019trustfile: $(srcsrc)/trustfile.c config.h
1020 $(COMPILE) $(VFLAG) -DSH_IDENT=\"@myident@\" -DTRUST_MAIN -DSL_ALWAYS_TRUSTED=@mytrust@ -o trustfile $(srcsrc)/trustfile.c
1021
1022sh_MK.h: config.h
1023 @echo "creating sh_MK.h"; \
1024 echo "#ifndef SH_MK_H" > sh_MK.h; \
1025 echo "#define SH_MK_H" >> sh_MK.h; \
1026 $(top_srcdir)/c_bits.sh @my_key_1@ MKB >> sh_MK.h; \
1027 $(top_srcdir)/c_bits.sh @my_key_2@ MKA >> sh_MK.h; \
1028 $(top_srcdir)/c_bits.sh @my_key_3@ MKC >> sh_MK.h; \
1029 $(top_srcdir)/c_bits.sh @my_key_4@ MKD >> sh_MK.h; \
1030 echo "#endif" >> sh_MK.h
1031
1032
1033sstrip: $(srcsrc)/sstrip.c Makefile
1034 $(COMPILE) -o sstrip $(srcsrc)/sstrip.c
1035
1036encode: $(srcsrc)/encode.c Makefile
1037 $(COMPILE) -o encode $(srcsrc)/encode.c
1038
1039config_xor.h: config.h encode
1040 @echo 'encode $(XOR_CODE) config.h'; \
1041 sleep 1; \
1042 ./encode $(XOR_CODE) config.h; \
1043 mv x_config.h config_xor.h
1044
1045#.c.o:
1046# @echo "./encode $(XOR_CODE) $< --> x_`echo $< |sed 's%.*/%%'`"; \
1047# ./encode $(XOR_CODE) $<; \
1048# echo "$(COMPILE) $(VFLAG) -o `echo $@ |sed 's%.*/%%'` -c x_`echo $< |sed 's%.*/%%'`"; \
1049# $(COMPILE) $(VFLAG) -o `echo $@ |sed 's%.*/%%'` -c x_`echo $< |sed 's%.*/%%'`; \
1050# rm x_`echo $< |sed 's%.*/%%'`
1051
1052$(OBJECTS):
1053 @echo "./encode $(XOR_CODE) $(srcsrc)/`echo $@ |sed 's%\.o$$%%'`.c --> x_`echo $@ |sed 's%\.o$$%%'`.c"; \
1054 ./encode $(XOR_CODE) $(srcsrc)/`echo $@ |sed 's%\.o$$%%'`.c; \
1055 echo "$(COMPILE) $(VFLAG) -o `echo $@ |sed 's%.*/%%'` -c x_`echo $@ |sed 's%\.o$$%%'`.c"; \
1056 $(COMPILE) $(VFLAG) -o `echo $@ |sed 's%.*/%%'` -c x_`echo $@ |sed 's%\.o$$%%'`.c; \
1057 rm x_`echo $@ |sed 's%\.o$$%%'`.c
1058
1059samhain_setpwd: encode config_xor.h $(srcsrc)/samhain_setpwd.c
1060 @echo '$(COMPILE) -o samhain_setpwd $(srcsrc)/samhain_setpwd.c'; \
1061 ./encode $(XOR_CODE) $(srcsrc)/samhain_setpwd.c; \
1062 $(COMPILE) -o samhain_setpwd x_samhain_setpwd.c; \
1063 rm x_samhain_setpwd.c
1064
1065samhain_stealth: encode config_xor.h $(srcsrc)/samhain_stealth.c
1066 @echo '$(COMPILE) -o samhain_stealth $(srcsrc)/samhain_stealth.c'; \
1067 ./encode $(XOR_CODE) $(srcsrc)/samhain_stealth.c; \
1068 $(COMPILE) -o samhain_stealth x_samhain_stealth.c; \
1069 rm x_samhain_stealth.c
1070
1071yulectl: encode config_xor.h $(srcsrc)/yulectl.c
1072 @echo '$(COMPILE) -o yulectl $(srcsrc)/yulectl.c $(LIBS_SOCK)'; \
1073 ./encode $(XOR_CODE) $(srcsrc)/yulectl.c; \
1074 $(COMPILE) -o yulectl x_yulectl.c $(LIBS_SOCK); \
1075 rm x_yulectl.c
1076
1077$(SAMHAIN): internal.h $(OBJECTS)
1078 @-rm -f $(SAMHAIN)
1079 @echo "$(LINK) $(OBJECTS) $(LIBS_TRY)"; \
1080 $(LINK) $(OBJECTS) $(LIBS_TRY)
1081
1082
1083
1084samhain_hide.o: $(srcsrc)/samhain_hide.c samhain_erase.o
1085 gcc @lkm_inc@ -I. -Wall -O2 -c $(srcsrc)/samhain_hide.c
1086
1087samhain_erase.o: $(srcsrc)/samhain_erase.c
1088 gcc @lkm_inc@ -I. -Wall -O2 -c $(srcsrc)/samhain_erase.c
1089
1090# -- NEW --
1091samhain_hide.ko: $(srcsrc)/samhain_hide.c
1092 @test -d m_comp || mkdir m_comp; \
1093 echo "KVERSION := \$$(shell uname -r)" > m_comp/Makefile;\
1094 echo "KSOURCE ?= /lib/modules/\$$(KVERSION)/build" >> m_comp/Makefile;\
1095 echo "obj-m := samhain_hide.o" >> m_comp/Makefile;\
1096 echo ".PHONY: modules install clean modules_add" >> m_comp/Makefile;\
1097 echo "install : modules_add" >> m_comp/Makefile;\
1098 echo "modules modules_install clean:" >> m_comp/Makefile;\
1099 echo "T\$$(MAKE) -C \$$(KSOURCE) \$$@ SUBDIRS=\$$(CURDIR) KBUILD_VERBOSE=2" | tr T '\t' >> m_comp/Makefile;\
1100 cp config.h m_comp/; \
1101 cp $(srcsrc)/samhain_hide.c m_comp/; \
1102 cd m_comp && make modules
1103 @if test -f m_comp/samhain_hide.ko; then \
1104 cp -p m_comp/samhain_hide.ko samhain_hide.ko; \
1105 rm -rf m_comp/; \
1106 else \
1107 echo "Kernel module samhain_hide.ko not build"; \
1108 exit 1; \
1109 fi
1110
1111# -- NEW --
1112lkm: @sh_lkm@
1113
1114
1115
1116# For kernel syscall monitoring
1117kern_head: Makefile $(top_srcdir)/include/kern_head.h $(srcsrc)/kern_head.c
1118 @echo "$(COMPILE) -DSYSTEMMAP=\"@systemmap@\" -o kern_head $(srcsrc)/kern_head.c $(LIBS_KVM)"; \
1119 $(COMPILE) -DSYSTEMMAP=\"@systemmap@\" -o kern_head $(srcsrc)/kern_head.c $(LIBS_KVM)
1120
1121sh_ks.h: kern_head
1122 @sleep 1; \
1123 ./kern_head > sh_ks.h
1124
1125sh_ks_xor.h: encode sh_ks.h
1126 @echo 'encode $(XOR_CODE) sh_ks.h'; \
1127 sleep 1; \
1128 ./encode $(XOR_CODE) sh_ks.h; \
1129 mv x_sh_ks.h sh_ks_xor.h
1130
1131# For bignum
1132internal.h: mkhdr
1133 @sleep 1; \
1134 ./mkhdr
1135
1136bignum.o: internal.h
1137
1138# If your compiler can't handle long identifiers (> 6 chars), move the `#' to
1139# the other line.
1140
1141mkhdr: $(srcsrc)/mkhdr.c config.h
1142 @echo "$(COMPILE) -o mkhdr $(srcsrc)/mkhdr.c"; \
1143 sleep 1; \
1144 $(COMPILE) -o mkhdr $(srcsrc)/mkhdr.c
1145
1146# $(COMPILE) -DBIG_SHORT_NAMES -o mkhdr $(srcdir)/mkhdr.c
1147
1148#----------------------------------------------------------
1149#
1150# EXE PACKER rules
1151#
1152#----------------------------------------------------------
1153
1154minilzo.o: $(srcsrc)/minilzo.c $(srcinc)/lzoconf.h $(srcinc)/minilzo.h config.h
1155 @echo "$(COMPILE) -DMINILZO_HAVE_CONFIG_H -o minilzo.o -c $(srcsrc)/minilzo.c"; \
1156 $(COMPILE) -DMINILZO_HAVE_CONFIG_H -o minilzo.o -c $(srcsrc)/minilzo.c
1157
1158exepack_mkdata: $(srcsrc)/exepack_mkdata.c $(srcinc)/lzoconf.h $(srcinc)/minilzo.h minilzo.o
1159 @echo "$(COMPILE) -o exepack_mkdata.o -c $(srcsrc)/exepack_mkdata.c"; \
1160 $(COMPILE) -o exepack_mkdata.o -c $(srcsrc)/exepack_mkdata.c; \
1161 echo "$(LINK) exepack_mkdata.o minilzo.o"; \
1162 $(LINK) exepack_mkdata.o minilzo.o
1163
1164#
1165# prepare the data to be packed
1166#
1167exepack.data: $(SAMHAIN) exepack_mkdata sstrip
1168 @echo "cp ./$(SAMHAIN) ./samhain.pk.data"; \
1169 cp ./$(SAMHAIN) ./samhain.pk.data; \
1170 echo "strip ./samhain.pk.data"; \
1171 strip ./samhain.pk.data > /dev/null 2>&1 || echo "... is already stripped"; \
1172 echo "./sstrip ./samhain.pk.data"; \
1173 ./sstrip ./samhain.pk.data > /dev/null 2>&1 || echo "sstrip returned false"; \
1174 echo "./exepack_mkdata ./samhain.pk.data ./exepack.data 0"; \
1175 ./exepack_mkdata ./samhain.pk.data ./exepack.data 0; \
1176 echo "rm -f ./samhain.pk.data"; \
1177 rm -f ./samhain.pk.data;
1178
1179exepack: $(srcsrc)/exepack.c minilzo.o exepack.data
1180 @echo "$(COMPILE) -o exepack.o -c $(srcsrc)/exepack.c"; \
1181 $(COMPILE) -o exepack.o -c $(srcsrc)/exepack.c; \
1182 echo "$(LINK) exepack.o minilzo.o"; \
1183 $(LINK) exepack.o minilzo.o;
1184
1185#
1186# this program fills the data section with the binary
1187#
1188exepack_fill: $(srcsrc)/exepack_fill.c minilzo.o exepack
1189 @echo "$(COMPILE) -o exepack_fill.o -c $(srcsrc)/exepack_fill.c"; \
1190 $(COMPILE) -o exepack_fill.o -c $(srcsrc)/exepack_fill.c; \
1191 echo "$(LINK) exepack_fill.o minilzo.o"; \
1192 $(LINK) exepack_fill.o minilzo.o
1193
1194samhain.pk: $(SAMHAIN) exepack exepack_fill sstrip
1195 @echo "cp ./$(SAMHAIN) ./samhain.pk.data"; \
1196 cp ./$(SAMHAIN) ./samhain.pk.data; \
1197 echo "strip ./samhain.pk.data"; \
1198 strip ./samhain.pk.data > /dev/null 2>&1 || echo "... is already stripped"; \
1199 echo "./sstrip ./samhain.pk.data"; \
1200 ./sstrip ./samhain.pk.data > /dev/null 2>&1 || echo "sstrip returned false"; \
1201 test -f exepack.out && rm exepack.out; \
1202 echo "./exepack_fill exepack samhain.pk.data exepack.out"; \
1203 ./exepack_fill exepack samhain.pk.data exepack.out; \
1204 chmod +x exepack.out; \
1205 echo "strip exepack.out"; \
1206 strip exepack.out > /dev/null 2>&1 || echo "... is already stripped"; \
1207 ./sstrip exepack.out > /dev/null 2>&1 || echo "sstrip returned false"; \
1208 echo "mv exepack.out samhain.pk"; \
1209 rm -f samhain.pk; mv exepack.out samhain.pk
1210
1211samhain-packed: $(SAMHAIN) samhain_setpwd
1212 @echo "samhain_setpwd samhain new $(CLIENTPASSWD)"; \
1213 samhain_setpwd samhain new $(CLIENTPASSWD); \
1214 echo "rm -f samhain; mv samhain.new samhain"; \
1215 rm -f samhain; mv samhain.new samhain; \
1216 $(MAKE) samhain.pk; \
1217 echo "rm -f samhain; mv samhain.pk samhain"; \
1218 rm -f samhain; mv samhain.pk samhain
1219
1220#----------------------------------------------------------
1221#
1222# DEPLOY rules
1223#
1224#----------------------------------------------------------
1225
1226uninstall-deploy:
1227 rm -rf $(mydatadir)/profiles/source
1228 rm -rf $(mydatadir)/profiles/archpkg
1229 rm -rf $(mydatadir)/profiles/libexec
1230 rm -rf $(mydatadir)/profiles/tmp
1231 rm -rf $(mydatadir)/profiles/private
1232 @if test -f $(sbindir)/deploy.sh; then \
1233 old_deploy=`grep 'VERSION2' $(sbindir)/deploy.sh >/dev/null 2>&1 || echo old`; \
1234 if test x"$$old_deploy" = xold; then \
1235 echo "rm -f $(sbindir)/deploy2.sh"; \
1236 rm -f $(sbindir)/deploy2.sh; \
1237 else \
1238 echo "rm -f $(sbindir)/deploy.sh"; \
1239 rm -f $(sbindir)/deploy.sh; \
1240 fi; \
1241 fi
1242
1243EXECFILES= comCHECKSRC comDOWNLOAD comBUILD comCLEAN comINSTALL \
1244 funcDIALOG funcEXE funcPRINT funcSETUP funcBUILD funcINSTALL \
1245 funcDB comUNINSTALL \
1246 preinstall postinstall initscript
1247
1248# $(mydatadir)/profiles/
1249# |
1250# |
1251# |-- source -------------> (tarballs)
1252# |
1253# |-- configs ------------> (default configs)
1254# |
1255# |-- archpkg
1256# | |
1257# | |-- architecture -> (package, setup script)
1258# |
1259# |-- hosts
1260# | |
1261# | |-- hostname -----> (config)
1262# |
1263# |-- libexec ------------> (scripts)
1264# |
1265# |-- private ------------> (gpg key)
1266# |
1267# |-- tmp
1268#
1269install-deploy: deploy.sh samhain_stealth
1270 @echo "Creating directory tree under $(mydatadir)/profiles/"; \
1271 $(mkinstalldirs) $(sbindir); \
1272 $(mkinstalldirs) $(mydatadir)/profiles/source; \
1273 $(mkinstalldirs) $(mydatadir)/profiles/configs; \
1274 $(mkinstalldirs) $(mydatadir)/profiles/archpkg/debian_i386; \
1275 $(mkinstalldirs) $(mydatadir)/profiles/archpkg/gentoo_i386; \
1276 $(mkinstalldirs) $(mydatadir)/profiles/archpkg/redhat_i386; \
1277 $(mkinstalldirs) $(mydatadir)/profiles/archpkg/linux_i386; \
1278 $(mkinstalldirs) $(mydatadir)/profiles/archpkg/freebsd_i386;\
1279 $(mkinstalldirs) $(mydatadir)/profiles/archpkg/solaris; \
1280 $(mkinstalldirs) $(mydatadir)/profiles/archpkg/aix; \
1281 $(mkinstalldirs) $(mydatadir)/profiles/hosts; \
1282 $(mkinstalldirs) $(mydatadir)/profiles/libexec; \
1283 $(mkinstalldirs) $(mydatadir)/profiles/private; \
1284 $(mkinstalldirs) $(mydatadir)/profiles/tmp; \
1285 if test -f $(srcdir)/../$(PACKAGE)-$(VERSION).tar.gz.asc; then \
1286 if test -f $(srcdir)/../$(PACKAGE)-$(VERSION).tar.gz; then \
1287 echo "Installing source tarball"; \
1288 $(INSTALL_DATA) $(srcdir)/../$(PACKAGE)-$(VERSION).tar.gz.asc \
1289 $(mydatadir)/profiles/source/$(PACKAGE)-$(VERSION).tar.gz.asc; \
1290 $(INSTALL_DATA) $(srcdir)/../$(PACKAGE)-$(VERSION).tar.gz \
1291 $(mydatadir)/profiles/source/$(PACKAGE)-$(VERSION).tar.gz; \
1292 fi; \
1293 fi; \
1294 echo "Installing default configs"; \
1295 test -f $(mydatadir)/profiles/configs/freebsd_i386.samhainrc || \
1296 $(INSTALL_DATA) $(srcdir)/samhainrc.freebsd \
1297 $(mydatadir)/profiles/configs/freebsd_i386.samhainrc; \
1298 test -f $(mydatadir)/profiles/configs/debian_i386.samhainrc || \
1299 $(INSTALL_DATA) $(srcdir)/samhainrc.linux \
1300 $(mydatadir)/profiles/configs/debian_i386.samhainrc; \
1301 test -f $(mydatadir)/profiles/configs/gentoo_i386.samhainrc || \
1302 $(INSTALL_DATA) $(srcdir)/samhainrc.linux \
1303 $(mydatadir)/profiles/configs/gentoo_i386.samhainrc; \
1304 test -f $(mydatadir)/profiles/configs/redhat_i386.samhainrc || \
1305 $(INSTALL_DATA) $(srcdir)/samhainrc.linux \
1306 $(mydatadir)/profiles/configs/redhat_i386.samhainrc; \
1307 test -f $(mydatadir)/profiles/configs/linux_i386.samhainrc || \
1308 $(INSTALL_DATA) $(srcdir)/samhainrc.linux \
1309 $(mydatadir)/profiles/configs/linux_i386.samhainrc; \
1310 test -f $(mydatadir)/profiles/configs/solaris.samhainrc || \
1311 $(INSTALL_DATA) $(srcdir)/samhainrc.solaris \
1312 $(mydatadir)/profiles/configs/solaris.samhainrc; \
1313 test -f $(mydatadir)/profiles/configs/aix.samhainrc || \
1314 $(INSTALL_DATA) $(srcdir)/samhainrc.aix5.2.0 \
1315 $(mydatadir)/profiles/configs/aix.samhainrc; \
1316 if test -f $(mydatadir)/profiles/configs/generic.configure; then \
1317 :; \
1318 else \
1319 SH_FQDN_SYSTEM=`uname -n`; \
1320 SH_FQDN_DOMAIN=`grep -i domain /etc/resolv.conf |grep -v "\#" |awk '{print $$2}' |head -1`; \
1321 if test -n "$${SH_FQDN_SYSTEM}" -a -n "$${SH_FQDN_DOMAIN}"; then \
1322 sh_thishost="$${SH_FQDN_SYSTEM}.$${SH_FQDN_DOMAIN}"; \
1323 else \
1324 sh_thishost="FQDN_MISSING"; \
1325 fi; \
1326 outfile=$(mydatadir)/profiles/configs/generic.configure; \
1327 echo "'--enable-network=client'" > $$outfile; \
1328 echo "'--with-logserver=$${sh_thishost}'" >> $$outfile; \
1329 echo "'--with-data-file=REQ_FROM_SERVER/var/lib/samhain/samhain_file'" >> $$outfile; \
1330 echo "'--with-config-file=REQ_FROM_SERVER/etc/samhainrc'" >> $$outfile; \
1331 echo "'--enable-base=@mykeybase@'" >> $$outfile; \
1332 fi; \
1333 $(INSTALL_SHELL) $(srcdir)/mkinstalldirs \
1334 $(mydatadir)/profiles/libexec; \
1335 $(INSTALL_SHELL) $(srcdir)/install-sh \
1336 $(mydatadir)/profiles/libexec; \
1337 for ff in $(EXECFILES); do \
1338 test -f $(srcdir)/dsys/$$ff && $(INSTALL_SHELL) $(srcdir)/dsys/$$ff \
1339 $(mydatadir)/profiles/libexec; \
1340 done; \
1341 $(INSTALL_SHELL) samhain_stealth $(mydatadir)/profiles/libexec; \
1342 test -f $(srcdir)/dsys/0F571F6C.asc && $(INSTALL_DATA) $(srcdir)/dsys/0F571F6C.asc \
1343 $(mydatadir)/profiles/private; \
1344 convert +compress $(srcdir)/stealth_template.jpg stealth_template.ps >/dev/null || \
1345 { echo "*"; echo "* 'convert' not found or not working, not installing"; echo "* $(mydatadir)/profiles/private/stealth_template.ps"; echo "* (only required for installing packages built with --enable-stealth)"; echo "*"; }; \
1346 if test -f stealth_template.ps; then \
1347 if test -f $(mydatadir)/profiles/private/stealth_template.ps; then \
1348 :; \
1349 else \
1350 $(INSTALL_DATA) stealth_template.ps $(mydatadir)/profiles/private; \
1351 fi; \
1352 fi; \
1353 if test -f $(sbindir)/deploy.sh; then \
1354 old_deploy=`grep 'VERSION2' $(sbindir)/deploy.sh >/dev/null 2>&1 || echo old`; \
1355 if test x"$$old_deploy" = xold; then \
1356 echo "*"; echo "* Version 1 of deploy.sh found"; echo "*"; \
1357 echo "* Installing $(sbindir)/deploy2.sh"; echo "*"; \
1358 $(INSTALL_SHELL) deploy.sh $(sbindir)/deploy2.sh; \
1359 else \
1360 echo "Installing $(sbindir)/deploy.sh"; \
1361 $(INSTALL_SHELL) deploy.sh $(sbindir)/deploy.sh; \
1362 fi; \
1363 else \
1364 echo "Installing $(sbindir)/deploy.sh"; \
1365 $(INSTALL_SHELL) deploy.sh $(sbindir)/deploy.sh; \
1366 fi
1367
1368
1369#----------------------------------------------------------
1370#
1371# DISTRIBUTION rules
1372#
1373#----------------------------------------------------------
1374
1375distdir = $(PACKAGE)-$(VERSION)
1376top_distdir = $(distdir)
1377
1378# This target untars the dist file and tries a VPATH configuration. Then
1379# it guarantees that the distribution is self-contained by making another
1380# tarfile.
1381
1382#
1383# 1) make distribution tarfile
1384# 2) unpack the tarfile into distdir
1385# 3) create build and install directories
1386# 4) do the build in the build dir, with sources from distdir
1387# 5) check (there are no subdirs, thus does nothing)
1388# 6) install
1389# 7) installcheck (equal to check, does nothing)
1390#
1391distcheck: dist
1392 -rm -rf $(distdir)
1393 GZIP=$(GZIP) $(TAR) zxf $(distdir).tar.gz
1394 mkdir $(distdir)/=build
1395 mkdir $(distdir)/=inst
1396 dc_install_base=`cd $(distdir)/=inst && pwd`; \
1397 cd $(distdir)/=build \
1398 && ../configure --srcdir=.. --prefix=$$dc_install_base \
1399 && $(MAKE) \
1400 && $(MAKE) install
1401 -rm -rf $(distdir)
1402 -rm -f $(distdir).tar.gz.asc
1403 @gpg -a --detach-sign $(distdir).tar.gz; \
1404 $(TAR) chof $(distdir).tar $(distdir).tar.gz $(distdir).tar.gz.asc; \
1405 rm -f $(distdir).tar.gz; \
1406 rm -f $(distdir).tar.gz.asc; \
1407 gzip --best $(distdir).tar
1408 mv $(distdir).tar.gz $(PACKAGE)_signed-$(VERSION).tar.gz
1409 @echo "========================"; \
1410 echo "$(PACKAGE)_signed-$(VERSION).tar.gz is ready for distribution"; \
1411 echo "========================"
1412
1413#
1414# create a tarfile for the distibution
1415#
1416distrpm: distdirrpm
1417 -chmod -R a+r $(distdir)
1418 -rm -rf $(distdir).tar.gz
1419 -rm -rf $(distdir).tar
1420 $(TAR) chof $(distdir).tar $(distdir)
1421 gzip -c --best $(distdir).tar > $(distdir).tar.gz
1422 -rm -rf $(distdir)
1423
1424dist: distdir
1425 -chmod -R a+r $(distdir)
1426 -rm -rf $(distdir).tar.gz
1427 -rm -rf $(distdir).tar
1428 $(TAR) chof $(distdir).tar $(distdir)
1429 gzip -c --best $(distdir).tar > $(distdir).tar.gz
1430 -rm -rf $(distdir)
1431
1432#
1433# create a tarfile for the distibution
1434#
1435dist-sign: distdir
1436 -rm -f $(distdir)/scripts/samhain.ebuild
1437 -rm -f $(distdir)/scripts/samhain.ebuild-light
1438 -chmod -R a+r $(distdir)
1439 -rm -rf $(distdir).tar.gz
1440 -rm -rf $(distdir).tar
1441 $(TAR) chof $(distdir).tar $(distdir)
1442 gzip --best $(distdir).tar
1443 -rm -rf $(distdir)
1444 -rm -f $(distdir).tar.gz.asc
1445 gpg -a --detach-sign $(distdir).tar.gz
1446 $(TAR) chof $(distdir).tar $(distdir).tar.gz $(distdir).tar.gz.asc
1447 -rm -f $(distdir).tar.gz
1448 -rm -f $(distdir).tar.gz.asc
1449 gzip --best $(distdir).tar
1450 mv $(distdir).tar.gz $(PACKAGE)_signed-$(VERSION).tar.gz
1451
1452
1453#
1454# same as dist
1455#
1456dist-all: distdir
1457 -chmod -R a+r $(distdir)
1458 GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir)
1459 -rm -rf $(distdir)
1460
1461#
1462# create distribution directory and copy files into it
1463#
1464INITFILES=samhain.startIRIX samhain.startFreeBSD samhain.startSolaris \
1465samhain.startLSB samhain.startGentoo samhain.startLinux samhain.startHPUX
1466
1467SCRIPTFILES=redhat_i386.client.spec check_samhain.pl samhainadmin.pl
1468
1469distdir: distfilecheck
1470 -rm -f $(top_srcdir)/init/*~
1471 -rm -f $(top_srcdir)/dsys/*~
1472 -rm -f $(top_srcdir)/docs/*~
1473 -rm -f $(top_srcdir)/include/*~
1474 -rm -f $(top_srcdir)/src/*~
1475 -rm -f $(top_srcdir)/test/*~
1476 -rm -f $(top_srcdir)/scripts/*~
1477 (cd $(top_srcdir)/init && rm -f $(INITFILES))
1478 (cd $(top_srcdir)/scripts && rm -f $(SCRIPTFILES))
1479 -rm -rf $(distdir)
1480 mkdir $(distdir)
1481 -chmod 777 $(distdir)
1482 @for file in $(DISTFILES); do \
1483 d=$(top_srcdir); \
1484 if test -f $$d/$$file || test -d $$d/$$file; then \
1485 cp -pr $$d/$$file $(distdir)/$$file; \
1486 fi; \
1487 done; \
1488 cp scripts/samhain.spec $(distdir)/samhain.spec; \
1489 rm -f $(distdir)/scripts/*.spec
1490
1491#
1492# as distdir, but don't copy spec file from scripts
1493#
1494distdirrpm: distfilecheck
1495 -rm -rf $(distdir)
1496 mkdir $(distdir)
1497 -chmod 777 $(distdir)
1498 @if test -f ./samhain.spec; then \
1499 :; \
1500 else \
1501 echo "Error: ./samhain.spec not found, please run configure"; \
1502 exit 1; \
1503 fi
1504 @cp -p samhain.spec $(distdir)/samhain.spec; \
1505 for file in $(DISTFILES); do \
1506 d=$(top_srcdir); \
1507 if test -f $$d/$$file || test -d $$d/$$file; then \
1508 if test x"$$file" = "xsamhain.spec"; then \
1509 :; \
1510 else \
1511 cp -pr $$d/$$file $(distdir)/$$file; \
1512 fi; \
1513 fi; \
1514 done; \
1515 rm -f $(distdir)/scripts/*.spec
1516
1517
1518distfilecheck: $(top_srcdir)/config.h.in $(top_srcdir)/depend.sum
1519 @for file in $(DISTFILES); do \
1520 d=$(top_srcdir); \
1521 if test -f $$d/$$file || test -d $$d/$$file; then \
1522 : \
1523 else \
1524 echo "File not found: $$d/$$file"; \
1525 fi; \
1526 done
1527 @for file in $(SOURCES); do \
1528 if test -f $$file; then \
1529 : \
1530 else \
1531 echo "File not found: $$file"; \
1532 fi; \
1533 done
1534
1535
1536# DO NOT DELETE THIS LINE
1537
1538
1539samhain.o: $(srcsrc)/samhain.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_files.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_unix.h $(srcinc)/sh_getopt.h $(srcinc)/sh_readconf.h $(srcinc)/sh_hash.h $(srcinc)/sh_mail.h $(srcinc)/sh_tiger.h $(srcinc)/sh_gpg.h $(srcinc)/sh_mem.h $(srcinc)/sh_forward.h $(srcinc)/sh_tools.h $(srcinc)/sh_hash.h $(srcinc)/sh_extern.h $(srcinc)/sh_modules.h $(srcinc)/sh_ignore.h $(srcinc)/sh_prelink.h sh_MK.h $(srcinc)/sh_schedule.h
1540sh_unix.o: $(srcsrc)/sh_unix.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_unix.h $(srcinc)/sh_utils.h $(srcinc)/sh_mem.h $(srcinc)/sh_hash.h $(srcinc)/sh_tools.h $(srcinc)/sh_tiger.h $(srcinc)/sh_prelink.h $(srcinc)/sh_static.h $(srcinc)/sh_prelude.h $(srcinc)/sh_ignore.h
1541sh_utils.o: $(srcsrc)/sh_utils.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_tiger.h $(srcinc)/sh_entropy.h
1542sh_error.o: $(srcsrc)/sh_error.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_cat.h $(srcinc)/sh_database.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_tiger.h $(srcinc)/sh_mail.h $(srcinc)/sh_forward.h $(srcinc)/sh_prelude.h $(srcinc)/sh_tools.h $(srcinc)/sh_extern.h
1543sh_files.o: $(srcsrc)/sh_files.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_files.h $(srcinc)/sh_tiger.h $(srcinc)/sh_hash.h $(srcinc)/sh_ignore.h $(srcinc)/zAVLTree.h
1544sh_getopt.o: $(srcsrc)/sh_getopt.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_getopt.h $(srcinc)/sh_files.h $(srcinc)/sh_utils.h $(srcinc)/sh_mail.h $(srcinc)/sh_forward.h $(srcinc)/sh_hash.h $(srcinc)/sh_extern.h
1545sh_readconf.o: $(srcsrc)/sh_readconf.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_database.h $(srcinc)/sh_unix.h $(srcinc)/sh_utils.h $(srcinc)/sh_files.h $(srcinc)/sh_mail.h $(srcinc)/sh_calls.h $(srcinc)/sh_tiger.h $(srcinc)/sh_forward.h $(srcinc)/sh_modules.h $(srcinc)/sh_gpg.h $(srcinc)/sh_hash.h $(srcinc)/sh_ignore.h $(srcinc)/sh_prelink.h $(srcinc)/sh_extern.h $(srcinc)/sh_database.h $(srcinc)/sh_prelude.h
1546sh_tiger0.o: $(srcsrc)/sh_tiger0.c Makefile config_xor.h $(srcinc)/sh_tiger.h $(srcinc)/sh_unix.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h
1547sh_tiger1.o: $(srcsrc)/sh_tiger1.c Makefile config_xor.h
1548sh_tiger2.o: $(srcsrc)/sh_tiger2.c Makefile config_xor.h
1549sh_tiger1_64.o: $(srcsrc)/sh_tiger1_64.c Makefile config_xor.h
1550sh_tiger2_64.o: $(srcsrc)/sh_tiger2_64.c Makefile config_xor.h
1551sh_hash.o: $(srcsrc)/sh_hash.c Makefile config_xor.h $(srcinc)/sh_hash.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_tiger.h $(srcinc)/sh_gpg.h $(srcinc)/sh_unix.h $(srcinc)/sh_files.h $(srcinc)/sh_ignore.h $(srcinc)/sh_forward.h $(srcinc)/sh_hash.h
1552sh_mail.o: $(srcsrc)/sh_mail.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_unix.h $(srcinc)/sh_tiger.h $(srcinc)/sh_mail.h $(srcinc)/sh_utils.h $(srcinc)/sh_fifo.h $(srcinc)/sh_tools.h $(srcinc)/sh_static.h $(srcinc)/sh_tools.h
1553sh_mem.o: $(srcsrc)/sh_mem.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_mem.h
1554sh_entropy.o: $(srcsrc)/sh_entropy.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_tiger.h $(srcinc)/sh_calls.h $(srcinc)/sh_static.h
1555sh_forward.o: $(srcsrc)/sh_forward.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_tiger.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_forward.h $(srcinc)/sh_srp.h $(srcinc)/sh_fifo.h $(srcinc)/sh_tools.h $(srcinc)/sh_entropy.h $(srcinc)/sh_html.h $(srcinc)/sh_mail.h $(srcinc)/sh_socket.h $(srcinc)/sh_static.h $(srcinc)/rijndael-api-fst.h $(srcinc)/sh_readconf.h $(srcinc)/zAVLTree.h $(srcinc)/sh_extern.h
1556sh_modules.o: $(srcsrc)/sh_modules.c Makefile config_xor.h $(srcinc)/sh_modules.h $(srcinc)/sh_utmp.h $(srcinc)/sh_mounts.h $(srcinc)/sh_userfiles.h $(srcinc)/sh_kern.h $(srcinc)/sh_suidchk.h
1557sh_utmp.o: $(srcsrc)/sh_utmp.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_modules.h $(srcinc)/sh_utmp.h
1558sh_kern.o: $(srcsrc)/sh_kern.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_modules.h $(srcinc)/sh_kern.h sh_ks_xor.h $(srcinc)/sh_unix.h $(srcinc)/sh_hash.h
1559sh_suidchk.o: $(srcsrc)/sh_suidchk.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_modules.h $(srcinc)/sh_suidchk.h $(srcinc)/sh_hash.h $(srcinc)/sh_unix.h $(srcinc)/sh_files.h $(srcinc)/sh_schedule.h $(srcinc)/sh_calls.h
1560sh_srp.o: $(srcsrc)/sh_srp.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_tiger.h $(srcinc)/sh_mem.h $(srcinc)/sh_utils.h $(srcinc)/sh_srp.h $(srcinc)/bignum.h
1561sh_fifo.o: $(srcsrc)/sh_fifo.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_mem.h $(srcinc)/sh_unix.h
1562sh_tools.o: $(srcsrc)/sh_tools.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_mem.h $(srcinc)/sh_error.h $(srcinc)/sh_tools.h $(srcinc)/sh_utils.h $(srcinc)/sh_tiger.h $(srcinc)/sh_static.h $(srcinc)/rijndael-api-fst.h $(srcinc)/rijndael-api-fst.h
1563sh_html.o: $(srcsrc)/sh_html.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_forward.h $(srcinc)/sh_error.h $(srcinc)/sh_unix.h $(srcinc)/sh_utils.h $(srcinc)/sh_html.h $(srcinc)/zAVLTree.h
1564sh_gpg.o: $(srcsrc)/sh_gpg.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_tiger.h $(srcinc)/sh_static.h
1565sh_cat.o: $(srcsrc)/sh_cat.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_cat.h
1566sh_calls.o: $(srcsrc)/sh_calls.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_calls.h
1567sh_extern.o: $(srcsrc)/sh_extern.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_tiger.h $(srcinc)/sh_extern.h $(srcinc)/sh_calls.h $(srcinc)/sh_static.h
1568sh_database.o: $(srcsrc)/sh_database.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_cat.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h
1569sh_err_log.o: $(srcsrc)/sh_err_log.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h $(srcinc)/sh_tiger.h
1570sh_err_console.o: $(srcsrc)/sh_err_console.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_utils.h
1571sh_err_syslog.o: $(srcsrc)/sh_err_syslog.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h
1572sh_schedule.o: $(srcsrc)/sh_schedule.c Makefile config_xor.h $(srcinc)/sh_mem.h $(srcinc)/sh_schedule.h
1573bignum.o: $(srcsrc)/bignum.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/bignum.h
1574mkhdr.o: $(srcsrc)/mkhdr.c Makefile config.h
1575samhain_setpwd.o: $(srcsrc)/samhain_setpwd.c Makefile config_xor.h
1576samhain_stealth.o: $(srcsrc)/samhain_stealth.c Makefile config_xor.h
1577encode.o: $(srcsrc)/encode.c Makefile
1578sstrip.o: $(srcsrc)/sstrip.c Makefile
1579trustfile.o: $(srcsrc)/trustfile.c Makefile config_xor.h $(srcinc)/sh_calls.h $(srcinc)/slib.h $(srcinc)/sh_static.h
1580exepack.o: $(srcsrc)/exepack.c Makefile config.h $(srcinc)/minilzo.h $(srcinc)/exepack.data
1581exepack_fill.o: $(srcsrc)/exepack_fill.c Makefile config.h config.h $(srcinc)/minilzo.h
1582exepack_mkdata.o: $(srcsrc)/exepack_mkdata.c Makefile config.h $(srcinc)/minilzo.h
1583minilzo.o: $(srcsrc)/minilzo.c Makefile $(srcinc)/minilzo.h
1584slib.o: $(srcsrc)/slib.c Makefile config_xor.h $(srcinc)/slib.h $(srcinc)/sh_calls.h $(srcinc)/sh_static.h
1585rijndael-alg-fst.o: $(srcsrc)/rijndael-alg-fst.c Makefile config_xor.h $(srcinc)/rijndael-alg-fst.h $(srcinc)/rijndael-boxes-fst.h
1586rijndael-api-fst.o: $(srcsrc)/rijndael-api-fst.c Makefile config_xor.h $(srcinc)/rijndael-alg-fst.h $(srcinc)/rijndael-api-fst.h
1587zAVLTree.o: $(srcsrc)/zAVLTree.c Makefile $(srcinc)/zAVLTree.h
1588sh_socket.o: $(srcsrc)/sh_socket.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_socket.h $(srcinc)/sh_error.h $(srcinc)/sh_unix.h $(srcinc)/sh_calls.h $(srcinc)/sh_utils.h $(srcinc)/zAVLTree.h $(srcinc)/sh_html.h $(srcinc)/sh_tools.h
1589sh_ignore.o: $(srcsrc)/sh_ignore.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_mem.h $(srcinc)/sh_error.h
1590yulectl.o: $(srcsrc)/yulectl.c Makefile config_xor.h
1591sh_mounts.o: $(srcsrc)/sh_mounts.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_utils.h $(srcinc)/sh_error.h $(srcinc)/sh_modules.h $(srcinc)/sh_mounts.h
1592sh_userfiles.o: $(srcsrc)/sh_userfiles.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_modules.h $(srcinc)/sh_userfiles.h $(srcinc)/sh_utils.h $(srcinc)/sh_schedule.h $(srcinc)/sh_error.h $(srcinc)/sh_hash.h $(srcinc)/sh_files.h
1593sh_prelude.o: $(srcsrc)/sh_prelude.c Makefile config_xor.h $(srcinc)/slib.h $(srcinc)/sh_cat.h $(srcinc)/sh_error_min.h $(srcinc)/sh_prelude.h
1594kern_head.o: $(srcsrc)/kern_head.c Makefile config.h $(srcinc)/kern_head.h $(srcinc)/kern_head.h
1595sh_prelink.o: $(srcsrc)/sh_prelink.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_tiger.h $(srcinc)/sh_extern.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h
1596sh_static.o: $(srcsrc)/sh_static.c Makefile config_xor.h
1597sh_prelude_old.o: $(srcsrc)/sh_prelude_old.c Makefile config_xor.h $(srcinc)/slib.h $(srcinc)/sh_mem.h $(srcinc)/sh_cat.h $(srcinc)/sh_error_min.h $(srcinc)/sh_prelude.h $(srcinc)/sh_static.h
Note: See TracBrowser for help on using the repository browser.