2016-12-18 15:50:32 +00:00
|
|
|
.SUFFIXES: .html .js .min.js
|
|
|
|
|
|
|
|
# The default installation is for a default-install OpenBSD box that's
|
|
|
|
# running HTTPS (only).
|
|
|
|
|
|
|
|
# File-system location (directory) of static media.
|
|
|
|
# See HTURI for the web-visible component.
|
2016-12-31 09:31:48 +00:00
|
|
|
HTDOCS = /usr/local/www/bouquins/
|
2016-12-18 15:50:32 +00:00
|
|
|
|
|
|
|
# URL location (path) of static media.
|
|
|
|
# See HTDOCS.
|
|
|
|
HTURI =
|
|
|
|
|
|
|
|
# File-system location (directory) of CGI script.
|
|
|
|
# See CGIURI.
|
2016-12-31 09:31:48 +00:00
|
|
|
CGIBIN = /usr/local/www/bouquins/cgi-bin
|
2016-12-18 15:50:32 +00:00
|
|
|
|
|
|
|
# File-system location of database.
|
|
|
|
# See RDDIR.
|
2016-12-31 09:31:48 +00:00
|
|
|
DATADIR = /usr/local/www/data
|
2016-12-18 15:50:32 +00:00
|
|
|
|
|
|
|
# Web-server relative location of system log file.
|
|
|
|
# This will have all logging messages by the system.
|
|
|
|
LOGFILE = /logs/system.log
|
|
|
|
|
|
|
|
# Compilation and link options.
|
|
|
|
# If on a static architecture, STATIC is -static; otherwise empty.
|
|
|
|
# I use /usr/local for kcgi and ksql, hence using them here.
|
|
|
|
STATIC = -static
|
|
|
|
CFLAGS += -I/usr/local/include
|
|
|
|
LDFLAGS += -L/usr/local/lib
|
|
|
|
|
|
|
|
# Web-server relative location of DATADIR.
|
|
|
|
# See DATADIR.
|
|
|
|
RDDIR = /data
|
|
|
|
|
|
|
|
# Name of installed CGI script, since some servers like to have ".cgi"
|
|
|
|
# appended to everything.
|
|
|
|
# See TARGET.
|
|
|
|
CGINAME = bouquins
|
|
|
|
|
|
|
|
# URL location (filename) of CGI script.
|
|
|
|
# See CGIBIN and CGINAME.
|
|
|
|
CGIURI = /cgi-bin/$(CGINAME)
|
|
|
|
|
|
|
|
# This is the name of the binary we're going to build.
|
|
|
|
# It differs from CGINAME in that it's the install source.
|
|
|
|
# See CGINAME.
|
|
|
|
TARGET = bouquins
|
|
|
|
|
|
|
|
# If on an HTTPS-only installation, should be "-DSECURE".
|
|
|
|
SECURE = -DSECURE
|
|
|
|
|
|
|
|
# File-system location (directory) of Swagger API.
|
|
|
|
APIDOCS = /var/www/htdocs/api-docs
|
|
|
|
|
|
|
|
# Override these with an optional local file.
|
|
|
|
sinclude GNUmakefile.local
|
|
|
|
|
|
|
|
DATABASE = metadata.db
|
2017-01-08 15:30:06 +00:00
|
|
|
OBJS = db.o db_author.o db_book.o db_series.o json.o main.o
|
2016-12-31 09:31:48 +00:00
|
|
|
|
2017-01-14 16:38:40 +00:00
|
|
|
HTMLS = index.html book.html author.html series.html search.html
|
|
|
|
JSMINS = index.min.js book.min.js author.min.js series.min.js search.min.js
|
2016-12-31 09:31:48 +00:00
|
|
|
EXTJS = externals/vue.min.js
|
|
|
|
CSS = externals/bootstrap.min.css
|
|
|
|
FONTS = externals/fonts/*
|
|
|
|
|
2016-12-18 15:50:32 +00:00
|
|
|
CFLAGS += -g -W -Wall -O2 $(SECURE)
|
|
|
|
CFLAGS += -DLOGFILE=\"$(LOGFILE)\"
|
|
|
|
CFLAGS += -DDATADIR=\"$(RDDIR)\"
|
|
|
|
CFLAGS += -DDATABASE=\"$(DATABASE)\"
|
|
|
|
VERSION = 0.0.0
|
|
|
|
|
2017-01-15 10:43:07 +00:00
|
|
|
.if defined(DEBUG)
|
|
|
|
CFLAGS += -DDEBUG
|
|
|
|
.endif
|
|
|
|
|
2016-12-18 15:50:32 +00:00
|
|
|
all: $(TARGET) $(HTMLS) $(JSMINS)
|
|
|
|
|
|
|
|
api: swagger.json
|
|
|
|
|
|
|
|
installwww: all
|
2016-12-31 09:31:48 +00:00
|
|
|
mkdir -p $(HTDOCS) $(HTDOCS)/css $(HTDOCS)/fonts $(HTDOCS)/js
|
|
|
|
install -m 0444 $(HTMLS) $(HTDOCS)
|
|
|
|
install -m 0444 $(JSMINS) $(EXTJS) $(HTDOCS)/js
|
|
|
|
install -m 0444 $(CSS) $(HTDOCS)/css
|
|
|
|
install -m 0444 $(FONTS) $(HTDOCS)/fonts
|
2016-12-18 15:50:32 +00:00
|
|
|
|
|
|
|
installapi: api
|
|
|
|
mkdir -p $(APIDOCS)
|
|
|
|
install -m 0444 swagger.json $(APIDOCS)
|
|
|
|
|
|
|
|
updatecgi: all
|
|
|
|
mkdir -p $(CGIBIN)
|
|
|
|
install -m 0555 $(TARGET) $(CGIBIN)/$(CGINAME)
|
2016-12-31 09:31:48 +00:00
|
|
|
install -m 0555 $(OBJS) $(CGIBIN)/
|
2016-12-18 15:50:32 +00:00
|
|
|
|
|
|
|
installcgi: updatecgi
|
|
|
|
mkdir -p $(DATADIR)
|
|
|
|
chmod 0777 $(DATADIR)
|
|
|
|
|
|
|
|
clean:
|
2016-12-18 17:29:39 +00:00
|
|
|
rm -f $(TARGET) $(JSMINS) $(OBJS)
|
2016-12-18 15:50:32 +00:00
|
|
|
rm -f swagger.json
|
|
|
|
|
|
|
|
.js.min.js:
|
|
|
|
sed -e "s!@HTURI@!$(HTURI)!g" \
|
|
|
|
-e "s!@VERSION@!$(VERSION)!g" \
|
|
|
|
-e "s!@CGIURI@!$(CGIURI)!g" $< >$@
|
|
|
|
|
|
|
|
$(TARGET): $(OBJS)
|
2017-04-02 18:35:55 +00:00
|
|
|
$(CC) $(STATIC) -o $@ $(OBJS) $(LDFLAGS) -lksql -lkcgi -lkcgijson -lz -lsqlite3 -pthread
|
2016-12-18 15:50:32 +00:00
|
|
|
|
|
|
|
$(OBJS): extern.h
|
|
|
|
|
|
|
|
swagger.json: swagger.in.json
|
|
|
|
@rm -f $@
|
|
|
|
sed -e "s!@VERSION@!$(VERSION)!g" -e "s!@TARGET@!$(TARGET)!g" swagger.in.json >$@
|
|
|
|
@chmod 400 $@
|
|
|
|
|
|
|
|
|