forked from cvicente/Netdot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
143 lines (119 loc) · 3.35 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# THIS IS USED BY utility-Makefile.
# Specify where the toplevel make file was called so that that
# recursively called makefiles have a point of reference for relative
# paths. Is there a built in way to do this?
SRCROOT := $(shell pwd)
# Netdot Makefile
#
PERL ?= /usr/bin/perl
PREFIX ?= /usr/local/netdot
APACHEUSER ?= apache
APACHEGROUP ?= apache
MAKE ?= make
SED ?= sed
usage:
@echo
@echo "usage: make install|installdb|upgrade [ PARAMETER=value ]"
@echo
@echo "You can either specify parameter values on the command"
@echo "line or you can modify them in the Makefile."
@echo
@echo "Current defaults are:"
@echo
@echo " PERL = $(PERL)"
@echo " PREFIX = $(PREFIX)"
@echo " APACHEUSER = $(APACHEUSER)"
@echo " APACHEGROUP = $(APACHEGROUP)"
@echo " MAKE = $(MAKE)"
@echo " SED = $(SED)"
@echo
@echo "For the defaults used in database installation/upgrade, please see "
@echo "bin/Makefile. In particular, these variables may be of interest: "
@echo
@echo " DB_TYPE "
@echo " DB_HOME "
@echo " DB_DBA "
@echo " DB_HOST "
@echo " DB_NETDOT_USER "
@echo " DB_NETDOT_PASS "
@echo
@echo "Please adjust as necessary, but at your own risk!"
@echo
#
# You really don't want to muck with anything below.
# You're responsible if you do.
#
DMOD ?= 0775
FMOD ?= 0644
XMOD ?= 0744
# This adds all previously defined variables to the shell environment
# which makes them available in children makefiles
export
# If mason ever decides to use different directories in its data_dir there will
# be trouble.
DIR = bin doc htdocs tmp tmp/sessions /tmp/sessions/locks lib etc var import export
.PHONY: bin doc htdocs lib etc var upgrade
install: dir doc htdocs lib var bin etc _import _export
@echo
@echo "Netdot is installed. "
@echo "Please read the available documentation before proceeding."
upgrade:
cd $@; $(MAKE) all DIR=$@
testdeps:
@echo "Testing for required Perl modules"
$(PERL) bin/perldeps.pl test
installdeps:
@echo "Installing required Perl modules"
$(PERL) bin/perldeps.pl install
apt-install:
@echo "Installing required APT packages"
$(PERL) bin/perldeps.pl apt-install
rpm-install:
@echo "Installing required RPM packages"
$(PERL) bin/perldeps.pl rpm-install
dir:
@echo
@echo "Creating necessary directories..."
echo $(PREFIX) > ./.prefix
for dir in $(DIR); do \
if test -d $(PREFIX)/$$dir; then \
echo "Skipping dir $(PREFIX)/$$dir; already exists"; \
else \
mkdir -m $(DMOD) -p $(PREFIX)/$$dir ; \
fi ; \
done
chown -R $(APACHEUSER):$(APACHEGROUP) $(PREFIX)/tmp
chmod 750 $(PREFIX)/tmp
htdocs:
cd $@ ; $(MAKE) all DIR=$@
doc:
cd $@ ; $(MAKE) all DIR=$@
lib:
cd $@ ; $(MAKE) all DIR=$@
var:
cd $@ ; $(MAKE) all DIR=$@
bin:
cd $@; $(MAKE) install DIR=$@
etc:
cd $@; $(MAKE) all DIR=$@
_import:
@echo "Going into $@..."
cd import ; $(MAKE) install DIR=import
_export:
@echo "Going into $@..."
cd export ; $(MAKE) all DIR=export
dropdb:
@echo "WARNING: This will erase all data in the database!"
cd bin ; $(MAKE) dropdb
genschema:
@echo "Generating Database Schema"
cd bin ; $(MAKE) genschema
installdb:
echo $(PREFIX) > ./.prefix
@echo "Preparing to create netdot database"
cd bin ; $(MAKE) installdb
defragdb:
@echo "Defragmenting the Database"
cd bin ; $(MAKE) defragdb
oui:
cd bin ; $(MAKE) oui