Commit 41887ba6 authored by gerd's avatar gerd

Updated build system for new directory structure


git-svn-id: https://godirepo.camlcity.org/svn/app-wtimer/trunk@5 f6fe576d-e0d0-0310-b8e7-f4ac0f1a5269
parent dc2fa782
......@@ -2,13 +2,18 @@
.PHONY: all opt clean install
all:
cd static && $(MAKE) all
cd src && $(MAKE) all
opt:
cd static && $(MAKE) opt
cd src && $(MAKE) opt
clean:
cd static && $(MAKE) clean
cd src && $(MAKE) clean
install:
cd static && $(MAKE) install
cd src && $(MAKE) install
cd ddl && $(MAKE) install
TOP=..
include ../Makefile.conf
createdb: createdb_$(DBVARIANT)
dropdb: dropdb_$(DBVARIANT)
# ----------------------------------------------------------------------
# PostgreSql
# ----------------------------------------------------------------------
createdb_pg:
createdb wtimer
psql -f wtimerdb_pg.sql wtimer
dropdb_pg:
dropdb wtimer
include ./Makefile.db
# ----------------------------------------------------------------------
# MySQL
# Installation etc.
# ----------------------------------------------------------------------
MY_OPTIONS = --password
createdb_my:
mysql $(MY_OPTIONS) -e 'create database wtimer'
mysql $(MY_OPTIONS) wtimer <wtimerdb_my.sql
install:
mkdir -p $(INST_PREFIX)$(DDL_DIR)
cp *.sql $(INST_PREFIX)$(DDL_DIR)
cat Makefile.db $(TOP)/Makefile.conf >$(INST_PREFIX)$(DDL_DIR)/Makefile
dropdb_my:
mysql $(MY_OPTIONS) -e 'drop database wtimer'
include $(TOP)/Makefile.conf
# ----------------------------------------------------------------------
# Database drivers
# ----------------------------------------------------------------------
createdb: createdb_$(DBVARIANT)
dropdb: dropdb_$(DBVARIANT)
# ----------------------------------------------------------------------
# PostgreSql
# ----------------------------------------------------------------------
createdb_pg:
createdb wtimer
psql -f wtimerdb_pg.sql wtimer
dropdb_pg:
dropdb wtimer
# ----------------------------------------------------------------------
# MySQL
# ----------------------------------------------------------------------
MY_OPTIONS = --password
createdb_my:
mysql $(MY_OPTIONS) -e 'create database wtimer'
mysql $(MY_OPTIONS) wtimer <wtimerdb_my.sql
dropdb_my:
mysql $(MY_OPTIONS) -e 'drop database wtimer'
# .. Now the build-time configuration:
......@@ -6,6 +6,8 @@
# make install installs the created application
#----------------------------------------------------------------------
TOP = ..
.PHONY: all
all: symlinks
rm -f depend
......@@ -20,13 +22,8 @@ opt: symlinks
clean:
rm -f *.cmi *.cmo *.cma *.cmx *.o *.a *.cmxa
rm -f wtimer.ui.bin wtimer.cgi wtimerd wtimer-admin
.PHONY: CLEAN
CLEAN: clean
.PHONY: distclean
distclean: clean
rm -f *~ depend depend.pkg
rm -f const.ml depend
rm -f wd_application_2.dtd
.PHONY: install
install:
......@@ -38,13 +35,9 @@ install:
cp *.ui wef.dtd $(INST_PREFIX)$(UI_DIR)
rm -f $(INST_PREFIX)$(UI_DIR)/wtimer-config.xml
ln -s $(ETC_DIR)/wtimer-config.xml $(INST_PREFIX)$(UI_DIR)
mkdir -p $(INST_PREFIX)$(STATIC_DIR)
cp *.jpeg *.png *.css *.js gpl.html $(INST_PREFIX)$(STATIC_DIR)
if [ -f wtimer.cgi ]; then mkdir -p $(INST_PREFIX)$(CGI_DIR) && cp wtimer.cgi $(INST_PREFIX)$(CGI_DIR); fi
if [ -f wtimerd ]; then mkdir -p $(INST_PREFIX)$(SBIN_DIR) && cp wtimerd $(INST_PREFIX)$(SBIN_DIR); fi
if [ -f wtimer-admin ]; then mkdir -p $(INST_PREFIX)$(BIN_DIR) && cp wtimer-admin $(INST_PREFIX)$(BIN_DIR); fi
mkdir -p $(INST_PREFIX)$(DDL_DIR)
cp ddl/Makefile ddl/*.sql $(INST_PREFIX)$(DDL_DIR)
.PHONY: symlinks
symlinks: wd_application_2.dtd
......@@ -52,4 +45,4 @@ symlinks: wd_application_2.dtd
wd_application_2.dtd:
ln -s `ocamlfind query wdialog`/wd_application_2.dtd .
include Makefile.conf
include $(TOP)/Makefile.conf
TOP = ..
OBJS = const.cmo get_config.cmo db_types.cmo \
db_pg.cmo db_my.cmo \
db.cmo db_ac.cmo db_xml.cmo \
......@@ -10,7 +12,7 @@ OBJS = const.cmo get_config.cmo db_types.cmo \
XOBJS = $(OBJS:.cmo=.cmx)
# "" or ".bin"
FORCE_BIN =
FORCE_BIN =
wtimer.cgi: wtimer.cgi.$(TARGET) wtimer.ui$(FORCE_BIN)
mv wtimer.cgi.$(TARGET) wtimer.cgi
......@@ -67,15 +69,15 @@ wtimer.ui.bin: wtimer.ui *.ui *.xml
wtimer.ui: main.ui
cp main.ui wtimer.ui
const.ml: const.mlp Makefile.conf
const.ml: const.mlp $(TOP)/Makefile.conf
sed -e 's:@VERSION@:$(VERSION):g' \
-e 's:@WTIMER_DIR@:$(WTIMER_DIR):g' \
-e 's:@UI_DIR@:$(UI_DIR):g' const.mlp >const.ml
db.cmo: db.ml Makefile.conf
db.cmo: db.ml $(TOP)/Makefile.conf
$(OCAMLC) -c -g -pp 'sed -e s:DBVARIANT:$(DBVARIANT):g' $<
db.cmx: db.ml Makefile.conf
db.cmx: db.ml $(TOP)/Makefile.conf
$(OCAMLOPT) -c -pp 'sed -e s:DBVARIANT:$(DBVARIANT):g' $<
......@@ -88,7 +90,7 @@ OCAMLOPT = $(OCAMLFIND) ocamlopt $(OPTIONS) -package "$(REQUIRES)"
OCAMLDEP = ocamldep $(OPTIONS)
OCAMLFIND = ocamlfind
depend: *.ml *.mli
depend: *.ml *.mli
if [ "x$(TARGET)" = "xopt" ]; then \
$(OCAMLDEP) -native *.ml *.mli >depend; \
else \
......@@ -111,5 +113,5 @@ depend: *.ml *.mli
*.mli:
include Makefile.conf
include $(TOP)/Makefile.conf
include depend
TOP = ..
.PHONY: all opt symlinks clean install
SRC_LINKS = definitions.css definitions.js
all: symlinks
opt: symlinks
clean:
rm -f $(SRC_LINKS)
install:
mkdir -p $(INST_PREFIX)$(STATIC_DIR)
cp *.jpeg *.png *.css *.js gpl.html $(INST_PREFIX)$(STATIC_DIR)
symlinks:
rm -f $(SRC_LINKS)
for x in $(SRC_LINKS); do ln -s ../src/$$x .; done
include $(TOP)/Makefile.conf
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment