Makefile 4.84 KB
Newer Older
1 2
# FOSSology Makefile - install/
# Copyright (C) 2008-2011 Hewlett-Packard Development Company, L.P.
3 4 5 6 7

# Create and install:
#  fo-postinstall
#  SYSCONFDIR/db.conf

8 9
TOP = ..
VARS = $(TOP)/Makefile.conf
10 11
include $(VARS)

12
CONFPATH = $(SYSCONFDIR)
13 14
# default version is the scm revision number
-DVERSION=$(SCM_REV)
15

16
all: fo-postinstall defconf/Db.conf defconf/fossology.conf db/dbcreate
17 18 19 20 21 22 23 24 25 26 27 28 29 30

# include the preprocessing stuff
include $(TOP)/Makefile.process

# generate the postinstall script
fo-postinstall:	fo-postinstall-process
	chmod +x fo-postinstall

# generate the default Db.conf file
defconf/Db.conf: defconf/Db.conf-process

# generate fossology.conf
defconf/fossology.conf:	defconf/fossology.conf-process

31 32 33
# create dbcreate
	$(MAKE) -s -C db

34 35
install_offline: install

36 37
install: all
	$(INSTALL_PROGRAM) fo-postinstall $(DESTDIR)$(LIBEXECDIR)/fo-postinstall
38 39
	$(INSTALL_PROGRAM) fo_dbcheck.php $(DESTDIR)$(LIBEXECDIR)/fo_dbcheck.php
	$(INSTALL_PROGRAM) fossinit.php $(DESTDIR)$(LIBEXECDIR)/fossinit.php
40
	$(MAKE) -s -C db install
41 42 43

	@echo "Making configuration directories"; \
	if [ ! -e $(DESTDIR)$(CONFPATH) ]; then \
44 45
		mkdir -p $(DESTDIR)$(CONFPATH); \
	fi
46
	@if [ ! -e $(DESTDIR)$(CONFPATH)/mods-enabled ]; then \
47
		mkdir -p $(DESTDIR)$(CONFPATH)/mods-enabled; \
48
		/bin/chmod 775 $(DESTDIR)$(CONFPATH)/mods-enabled; \
49
	fi
50 51

	@if [ ! -e $(DESTDIR)$(CONFPATH)/conf ]; then \
52 53
		mkdir -p $(DESTDIR)$(CONFPATH)/conf; \
	fi
54 55 56 57

	@echo "Installing configuration files..."

	@if [ ! -f $(DESTDIR)$(CONFPATH)/Db.conf -o "$(OVERWRITE)" ]; then \
58
		echo "NOTE: using default version for $(DESTDIR)$(CONFPATH)/Db.conf"; \
59
	 	$(INSTALL) -m 640 defconf/Db.conf $(DESTDIR)$(CONFPATH)/Db.conf; \
60 61 62
	else \
		echo "WARNING: $(DESTDIR)$(CONFPATH)/Db.conf already exists."; \
		echo "  Not overwriting, consider checking it by hand or use the OVERWRITE option."; \
63
	fi
64

65
	@if [ ! -f $(DESTDIR)$(CONFPATH)/fossology.conf -o "$(OVERWRITE)" ]; then \
66 67 68 69 70
		echo "NOTE: using default version for $(DESTDIR)$(CONFPATH)/fossology.conf"; \
	 	$(INSTALL) -m 666 defconf/fossology.conf $(DESTDIR)$(CONFPATH)/fossology.conf; \
	else \
		echo "WARNING: $(DESTDIR)$(CONFPATH)/fossology.conf already exists."; \
		echo "  Not overwriting, consider checking it by hand or use the OVERWRITE option."; \
71
	fi
72

73
	@if [ ! -f $(DESTDIR)$(CONFPATH)/sampleheader.txt -o "$(OVERWRITE)" ]; then \
74 75 76 77 78
		echo "NOTE: using default version for $(DESTDIR)$(CONFPATH)/sampleheader.txt"; \
	 	$(INSTALL) -m 666 defconf/sampleheader.txt $(DESTDIR)$(CONFPATH)/sampleheader.txt; \
	else \
		echo "WARNING: $(DESTDIR)$(CONFPATH)/sampleheader.txt already exists."; \
		echo "  Not overwriting, consider checking it by hand or use the OVERWRITE option."; \
79
	fi
80

81
	@if [ ! -f $(DESTDIR)$(CONFPATH)/samplefooter.txt -o "$(OVERWRITE)" ]; then \
82 83 84 85 86
		echo "NOTE: using default version for $(DESTDIR)$(CONFPATH)/samplefooter.txt"; \
	 	$(INSTALL) -m 666 defconf/samplefooter.txt $(DESTDIR)$(CONFPATH)/samplefooter.txt; \
	else \
		echo "WARNING: $(DESTDIR)$(CONFPATH)/samplefooter.txt already exists."; \
		echo "  Not overwriting, consider checking it by hand or use the OVERWRITE option."; \
87
	fi
88

89
	@if [ ! -f $(DESTDIR)$(CONFPATH)/conf/fo-apache.conf -o "$(OVERWRITE)" ]; then \
90 91 92 93 94
		echo "NOTE: using default version for $(DESTDIR)$(CONFPATH)/conf/fo-apache.conf"; \
	 	$(INSTALL) -m 666 fo-apache.conf $(DESTDIR)$(CONFPATH)/conf/fo-apache.conf; \
	else \
		echo "WARNING: $(DESTDIR)$(CONFPATH)/conf/fo-apache.conf already exists."; \
		echo "  Not overwriting, consider checking it by hand or use the OVERWRITE option."; \
95
	fi
96

97
	@if [ ! -f $(DESTDIR)$(CONFPATH)/conf/src-install-apache-example.conf -o "$(OVERWRITE)" ]; then \
98 99 100 101 102
		echo "NOTE: using default version for $(DESTDIR)$(CONFPATH)/conf/src-install-apache-example.conf"; \
	 	$(INSTALL) -m 666 src-install-apache-example.conf $(DESTDIR)$(CONFPATH)/conf/src-install-apache-example.conf; \
	else \
		echo "WARNING: $(DESTDIR)$(CONFPATH)/conf/src-install-apache-example.conf already exists."; \
		echo "  Not overwriting, consider checking it by hand or use the OVERWRITE option."; \
103
	fi
104 105 106

uninstall:
	rm -f $(DESTDIR)$(LIBEXECDIR)/fo-postinstall
107 108
	rm -f $(DESTDIR)$(CONFPATH)/sampleheader.txt
	rm -f $(DESTDIR)$(CONFPATH)/samplefooter.txt
109 110
	rm -f $(DESTDIR)$(LIBEXECDIR)/fossinit.php
	rm -f $(DESTDIR)$(LIBEXECDIR)/fo_dbcheck.php
111 112 113

	@if [ -d $(DESTDIR)$(LIBEXECDIR) ]; then \
		if [ "`ls -A $(DESTDIR)$(LIBEXECDIR)`" ]; then \
114
			echo "WARNING: $(DESTDIR)$(LIBEXECDIR) not empty, not removing"; \
115 116 117 118 119
		else \
			rmdir $(DESTDIR)$(LIBEXECDIR); \
		fi; \
	fi

120
	@echo "Configuration files will not be removed:"
121 122 123
	@echo "      $(DESTDIR)$(CONFPATH)/fossology.conf"
	@echo "      $(DESTDIR)$(CONFPATH)/Db.conf"
	@echo "  Remove by hand if you desire."
124
	$(MAKE) -s -C db uninstall
125 126

clean:
127 128
	rm -f fo-postinstall defconf/Db.conf defconf/fossology.conf
	$(MAKE) -s -C db clean
129 130

test: all
131
	@echo "nothing to do"
132

133 134
coverage: all
	@echo "nothing to do"
135

136
.PHONY: all install uninstall clean test coverage