reverting cloneTag bugs (see joshua mail on koha-devel) :
[koha.git] / Makefile
blob58e141abd4242a29c7601b0a3c1286681a483cb6
1 ### Commands
2 # STTY
3 # CHOWN
4 # CHMOD
5 # PERL
6 # MYSQL
7 # MYSQLADMIN
8 # INSTALL BSD-compatible install tool
10 ### MySQL database administration
11 # DBA_NAME Name of MySQL administrator
12 # DBA_PASSWD MySQL administrator password
14 ### Koha database
15 # DB_NAME Koha database name
16 # DB_USER Koha database user
17 # DB_PASSWD Koha database user's password
19 ### OPAC site
20 # OPAC_DOC_URL Root of tree containing HTML documents
21 # OPAC_CGI_URL Root of CGI tree
22 # OPAC_DOC_DIR Where to install HTML files
23 # OPAC_CGI_DIR Where to install CGI scripts
25 ### OPAC site
26 # INTRA_DOC_URL Root of tree containing HTML documents
27 # INTRA_CGI_URL Root of CGI tree
28 # INTRA_DOC_DIR Where to install HTML files
29 # INTRA_CGI_DIR Where to install CGI scripts
31 # Prefer 'install-sh -d' over 'mkdir', because 'install-sh' will
32 # create directories recursively if they don't exist. But not all
33 # Unices support 'mkdir -p'.
34 MKDIR = ./install-sh -d
36 # XXX - Add 'clean:' target.
38 include Make.conf
40 all:
41 @echo "Please use one of the following:"
42 @echo " config Configuration script"
43 @echo " install-db Install the database"
44 @echo " install-opac Install the OPAC web site"
45 @echo " install-intra Install the intranet web site"
47 config configure Make.conf koha.conf.new:
48 ./safe-installer
50 # XXX - Need to create the Koha user(s) and grant permissions before
51 # creating the database itself.
53 # Create the database.
55 # Given the semantics of the MySQL arguments, if $(DBA_PASSWD) isn't
56 # set, the user will be prompted for them (repeatedly).
58 # First, this runs 'mysqladmin status' to make sure that the current
59 # user can really connect to the database and do stuff. This really
60 # isn't a good test, since it really only checks that $(DBA_PASSWD)
61 # corresponds to $(DBA_USER), and that $(DBA_USER) is authorized to
62 # read a little bit, but it's better than nothing.
64 # Next, this runs 'mysqldump' on the database we want to create. If
65 # this exits with a zero status, then everything went well, which
66 # means that the database already exists. If 'mysqladmin' succeeded
67 # but 'mysqldump' failed, we figure it must be because the database
68 # doesn't exist yet, so we need to create it.
70 create-db: koha.mysql
71 @echo "Checking authorization to connect to MySQL"
72 @echo "You may be prompted for the database administrator's password"
73 $(MYSQLADMIN) "-u$(DBA_USER)" "-p$(DBA_PASSWD)" status >/dev/null 2>&1
74 @echo "Checking whether $(DB_NAME) already exists"
75 @echo "$(MYSQLDUMP) -d -u$(DBA_USER) -p$(DBA_PASSWD) $(DB_NAME) >/dev/null"
76 @if $(MYSQLDUMP) -d "-u$(DBA_USER)" "-p$(DBA_PASSWD)" $(DB_NAME) >/dev/null 2>&1; then \
77 echo "Database $(DB_NAME) already exists"; \
78 else \
79 echo "Creating database $(DB_NAME)"; \
80 echo "$(MYSQLADMIN) -u$(DBA_USER) -p<password> create $(DB_NAME)"; \
81 $(MYSQLADMIN) "-u$(DBA_USER)" "-p$(DBA_PASSWD)" create $(DB_NAME); \
82 echo "Adding tables to $(DB_NAME)"; \
83 $(MYSQL) "-u$(DBA_USER)" "-p$(DBA_PASSWD)" $(DB_NAME) < koha.mysql; \
86 # After ensuring that the database exists, bring it up to date.
87 # XXX - Currently, the sample data set assumes the v1.2 database,
88 # which is different from what 'updater/updatedatabase' will create.
89 # Hence, if the user wants to install the sample data, it'll be
90 # necessary to install it before running 'updater/updatedatabase'.
91 install-db: create-db
92 @echo "Updating database as necessary"
93 KOHA_CONF=koha.conf.new ./updater/updatedatabase
95 install-opac: install-opac-html install-opac-cgi
97 install-opac-html:
99 install-opac-cgi:
101 install-intra: install-intra-html install-intra-cgi
103 install-intra-html:
105 install-intra-cgi: