GNUmakefile 2.64 KB
Newer Older
1
#
2
# EMULAB-COPYRIGHT
Mike Hibler's avatar
Mike Hibler committed
3
# Copyright (c) 2000-2005, 2008 University of Utah and the Flux Group.
4 5 6
# All rights reserved.
#
#
7 8 9 10 11 12 13 14 15 16
# This makefile is different than all the others...
# 
# It is intended to be run in place in the cvs tree to update the files,
# and doesn't install or build anything else. This is why it doesn't go
# through configure, etc.
#

# The easy way: do 'gmake all'
# You can also run the individual targets too.

17
all: db-create db-create-errorlog db-fill sitevars old-db-create old-db-create-errorlog
18 19

db-create:
20
	@rm -f ./.tmp-db-create.sql ./.tmp-create-diff
21
	@mysqldump -d tbdb > ./.tmp-db-create.sql
22
	@-diff ./database-create.sql ./.tmp-db-create.sql > ./.tmp-create-diff
23 24 25
	@if test -s ./.tmp-create-diff; \
	then \
		cat ./.tmp-create-diff; \
26
		echo "NOTE: Don't forget to update database-migrate.txt!"; \
27 28
		mv ./.tmp-db-create.sql ./database-create.sql; \
	fi
29
	@rm -f ./.tmp-create-diff ./.tmp-db-create.sql
30

31 32 33 34 35 36 37 38 39 40 41 42
db-create-errorlog:
	@rm -f ./.tmp-db-create-errorlog.sql ./.tmp-create-diff-errorlog
	@mysqldump -d errorlog > ./.tmp-db-create-errorlog.sql
	@-diff ./database-create-errorlog.sql ./.tmp-db-create-errorlog.sql > ./.tmp-create-diff-errorlog
	@if test -s ./.tmp-create-diff-errorlog; \
	then \
		cat ./.tmp-create-diff-errorlog; \
		echo "NOTE: Don't forget to update database-migrate.txt!"; \
		mv ./.tmp-db-create-errorlog.sql ./database-create-errorlog.sql; \
	fi
	@rm -f ./.tmp-create-diff-errorlog ./.tmp-db-create-errorlog.sql

43 44 45 46 47 48 49
old-db-create:
	cp ./database-create.sql ./.tmp-db-create.sql
	sed -i '' -e 's/ENGINE=MyISAM DEFAULT CHARSET=latin1/TYPE=MyISAM/' ./.tmp-db-create.sql
	sed -i '' -e 's/ default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP//' ./.tmp-db-create.sql
	mv ./.tmp-db-create.sql ./database-create-old.sql
	@rm -f ./.tmp-db-create.sql

50 51 52 53 54 55 56
old-db-create-errorlog:
	cp ./database-create-errorlog.sql ./.tmp-db-create-errorlog.sql
	sed -i '' -e 's/ENGINE=MyISAM DEFAULT CHARSET=latin1/TYPE=MyISAM/' ./.tmp-db-create-errorlog.sql
	sed -i '' -e 's/ default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP//' ./.tmp-db-create-errorlog.sql
	mv ./.tmp-db-create-errorlog.sql ./database-create-old-errorlog.sql
	@rm -f ./.tmp-db-create-errorlog.sql

57 58 59 60
db-fill:
	@/usr/testbed/sbin/wap /usr/testbed/sbin/export_tables \
	  > database-fill.sql

61
db-fill-dist: knowlbase
62 63 64
	@/usr/testbed/sbin/wap /usr/testbed/sbin/export_tables -i \
	  > database-fill.sql

65
sitevars:
Mike Hibler's avatar
Mike Hibler committed
66
	@mysqldump --skip-opt --skip-quote-names -t tbdb sitevariables > sitevars-create.sql 
67

68 69 70
knowlbase:
	@mysqldump -c -t tbdb knowledge_base_entries | sed -e 's,^INSERT,REPLACE,' > knowlbase-create.sql 

71
fwrules:
72
	@echo "*** Use 'gmake insertrules' in the firewall subdir to do this"
73

74
dist:	db-fill-dist
75