Split the makefile.
This commit is contained in:
parent
81e5fbdc4c
commit
932688dca5
97
Makefile
97
Makefile
@ -1,97 +0,0 @@
|
||||
all: build-server
|
||||
|
||||
# For requests where authentication is required.
|
||||
LOGIN ?=
|
||||
ifeq ($(LOGIN),)
|
||||
LOGIN_OPT =
|
||||
else
|
||||
LOGIN_OPT = -l $(LOGIN)
|
||||
endif
|
||||
|
||||
OPTS ?= --progress
|
||||
Q ?= @
|
||||
|
||||
SOURCE_FILES = $(wildcard src/*.cr src/*/*.cr src/*/*/*.cr)
|
||||
|
||||
####################
|
||||
### REQUEST EXAMPLES
|
||||
####################
|
||||
|
||||
DOMAIN ?= example.com
|
||||
bin/write-zone-file: tools/write-zone-file.cr
|
||||
$(Q)-shards build write-zone-file $(OPTS)
|
||||
build-write-zone-file: bin/write-zone-file
|
||||
zone-file: build-write-zone-file
|
||||
$(Q)./bin/write-zone-file $(DOMAIN)
|
||||
|
||||
bin/write-template-zone-file: tools/write-template-zone-file.cr
|
||||
$(Q)-shards build write-template-zone-file $(OPTS)
|
||||
build-write-template-zone-file: bin/write-template-zone-file
|
||||
zone-basic-template-file: build-write-template-zone-file
|
||||
$(Q)./bin/write-template-zone-file $(DOMAIN)
|
||||
|
||||
bin/powerdns-sync: tools/powerdns-sync.cr
|
||||
$(Q)-shards build powerdns-sync $(OPTS)
|
||||
build-powerdns-sync: bin/powerdns-sync
|
||||
|
||||
VERBOSITY ?= 4
|
||||
run-client-verbosity:; $(Q)./bin/dnsmanager-client admin maintenance verbosity $(VERBOSITY) $(LOGIN_OPT)
|
||||
run-client-domain-add:; $(Q)./bin/dnsmanager-client user domain add $(DOMAIN) $(LOGIN_OPT)
|
||||
run-client-domain-del:; $(Q)./bin/dnsmanager-client user domain del $(DOMAIN) $(LOGIN_OPT)
|
||||
run-client-domain-list:; $(Q)./bin/dnsmanager-client user domain list $(LOGIN_OPT)
|
||||
run-client-zone-add:; $(Q)./bin/dnsmanager-client user zone add $(DOMAIN).json $(LOGIN_OPT)
|
||||
run-client-zone-get:; $(Q)./bin/dnsmanager-client user zone get $(DOMAIN) $(LOGIN_OPT)
|
||||
|
||||
RRID ?= 1
|
||||
NAME ?=
|
||||
TTL ?= 3600
|
||||
TARGET ?=
|
||||
run-client-rr-add-a:; $(Q)./bin/dnsmanager-client user rr add A $(DOMAIN) $(NAME) $(TTL) $(TARGET) $(LOGIN_OPT)
|
||||
run-client-rr-update-a:; $(Q)./bin/dnsmanager-client user rr update A $(DOMAIN) $(RRID) $(NAME) $(TTL) $(TARGET) $(LOGIN_OPT)
|
||||
run-client-rr-del:; $(Q)./bin/dnsmanager-client user rr del $(DOMAIN) $(RRID) $(LOGIN_OPT)
|
||||
run-client-genzones:; $(Q)./bin/dnsmanager-client admin genall $(LOGIN_OPT)
|
||||
|
||||
##################
|
||||
### SETUP COMMANDS
|
||||
##################
|
||||
|
||||
DBDIR=/tmp/DATA-dnsmanagerd
|
||||
bin/dnsmanagerd: $(SOURCE_FILES); $(Q)shards build dnsmanagerd $(OPTS)
|
||||
build-server: bin/dnsmanagerd
|
||||
run-dnsmanagerd:; $(Q)./bin/dnsmanagerd -v $(VERBOSITY) -r $(DBDIR)
|
||||
|
||||
bin/dnsmanager-client: $(SOURCE_FILES); $(Q)shards build dnsmanager-client $(OPTS)
|
||||
build-client: bin/dnsmanager-client
|
||||
|
||||
PORT ?= 8082
|
||||
ADDR ?=
|
||||
bin/token-handler: tools/token-handler.cr; $(Q)shards build token-handler $(OPTS)
|
||||
build-token-handler: bin/token-handler
|
||||
run-token-handler: bin/token-handler; $(Q)./bin/token-handler $(PORT) $(ADDR)
|
||||
|
||||
build: build-server build-client build-token-handler build-powerdns-sync
|
||||
|
||||
print-messages:; cat src/requests/*.cr | ./bin/get-messages.awk
|
||||
print-message-numbers:; make -s print-messages | grep -E "^[0-9]" | sort -n
|
||||
print-messages-no-comments:; make -s print-messages | grep -vE '^[[:blank:]]+#'
|
||||
print-response-messages:; cat src/responses/*.cr | ./bin/get-messages.awk
|
||||
print-response-message-numbers:; make -s print-response-messages | grep -E "^[0-9]" | sort -n
|
||||
print-response-messages-no-comments:; make -s print-response-messages | grep -vE '^[[:blank:]]+#'
|
||||
|
||||
doc:
|
||||
crystal docs src/main.cr src/client.cr lib/authd/src/client.cr
|
||||
|
||||
HTTPD_ACCESS_LOGS ?= /tmp/access-dnsmanager-docs.log
|
||||
HTTPD_ADDR ?= 127.0.0.1
|
||||
HTTPD_PORT ?= 9001
|
||||
DIR ?= docs
|
||||
serve-doc:
|
||||
darkhttpd $(DIR) --addr $(HTTPD_ADDR) --port $(HTTPD_PORT) --log $(HTTPD_ACCESS_LOGS)
|
||||
|
||||
wipe-db:
|
||||
rm -r $(DBDIR)
|
||||
|
||||
release:
|
||||
make build-server OPTS="--release --progress --no-debug"
|
||||
|
||||
-include migration.mk
|
15
makefile
Normal file
15
makefile
Normal file
@ -0,0 +1,15 @@
|
||||
all: build-server
|
||||
|
||||
Q ?= @
|
||||
|
||||
# By default, the following makefile rules will use the compiled version
|
||||
# of the applications (such as dnsmanagerd and dnsmanager-client),
|
||||
# not the ones from the system (in /usr/local/bin/ for example).
|
||||
# To avoid that, use: "make <rule> LOC="
|
||||
LOC ?= ./bin/
|
||||
|
||||
include mk/build.mk
|
||||
include mk/commands.mk
|
||||
include mk/setup.mk
|
||||
include mk/dev.mk
|
||||
-include mk/migration.mk
|
35
mk/build.mk
Normal file
35
mk/build.mk
Normal file
@ -0,0 +1,35 @@
|
||||
CRFLAGS ?= --progress
|
||||
SOURCE_FILES = $(wildcard src/*.cr src/*/*.cr src/*/*/*.cr)
|
||||
|
||||
bin/write-zone-file: tools/write-zone-file.cr
|
||||
$(Q)-shards build write-zone-file $(CRFLAGS)
|
||||
build-write-zone-file: bin/write-zone-file
|
||||
|
||||
bin/write-template-zone-file: tools/write-template-zone-file.cr
|
||||
$(Q)-shards build write-template-zone-file $(CRFLAGS)
|
||||
build-write-template-zone-file: bin/write-template-zone-file
|
||||
|
||||
bin/powerdns-sync: tools/powerdns-sync.cr
|
||||
$(Q)-shards build powerdns-sync $(CRFLAGS)
|
||||
build-powerdns-sync: bin/powerdns-sync
|
||||
|
||||
bin/dnsmanagerd: $(SOURCE_FILES)
|
||||
$(Q)shards build dnsmanagerd $(CRFLAGS)
|
||||
build-server: bin/dnsmanagerd
|
||||
|
||||
bin/dnsmanager-client: $(SOURCE_FILES)
|
||||
$(Q)shards build dnsmanager-client $(CRFLAGS)
|
||||
build-client: bin/dnsmanager-client
|
||||
|
||||
bin/token-handler: tools/token-handler.cr
|
||||
$(Q)shards build token-handler $(CRFLAGS)
|
||||
build-token-handler: bin/token-handler
|
||||
|
||||
# The documentation includes the `authd` API.
|
||||
doc:
|
||||
crystal docs src/main.cr src/client.cr lib/authd/src/client.cr
|
||||
|
||||
build: build-server build-client build-token-handler build-powerdns-sync
|
||||
|
||||
release:
|
||||
make build-server CRFLAGS="--release --progress --no-debug"
|
33
mk/commands.mk
Normal file
33
mk/commands.mk
Normal file
@ -0,0 +1,33 @@
|
||||
# This makefile provides a few examples of dnsmanager-client.
|
||||
# For a more thorough documentation, read the manual.
|
||||
|
||||
# For requests where authentication is required.
|
||||
LOGIN ?=
|
||||
ifeq ($(LOGIN),)
|
||||
LOGIN_OPT =
|
||||
else
|
||||
LOGIN_OPT = -l $(LOGIN)
|
||||
endif
|
||||
|
||||
DOMAIN ?= example.com
|
||||
zone-file: build-write-zone-file; $(Q)$(LOC)write-zone-file $(DOMAIN)
|
||||
zone-basic-template-file: build-write-template-zone-file; $(Q)$(LOC)write-template-zone-file $(DOMAIN)
|
||||
|
||||
VERBOSITY ?= 4
|
||||
run-client-verbosity:; $(Q)$(LOC)dnsmanager-client admin maintenance verbosity $(VERBOSITY) $(LOGIN_OPT)
|
||||
run-client-domain-add:; $(Q)$(LOC)dnsmanager-client user domain add $(DOMAIN) $(LOGIN_OPT)
|
||||
run-client-domain-del:; $(Q)$(LOC)dnsmanager-client user domain del $(DOMAIN) $(LOGIN_OPT)
|
||||
run-client-domain-list:; $(Q)$(LOC)dnsmanager-client user domain list $(LOGIN_OPT)
|
||||
run-client-zone-add:; $(Q)$(LOC)dnsmanager-client user zone add $(DOMAIN).json $(LOGIN_OPT)
|
||||
run-client-zone-get:; $(Q)$(LOC)dnsmanager-client user zone get $(DOMAIN) $(LOGIN_OPT)
|
||||
|
||||
RRID ?= 1
|
||||
NAME ?=
|
||||
TTL ?= 3600
|
||||
TARGET ?=
|
||||
run-client-rr-add-a:
|
||||
$(Q)$(LOC)dnsmanager-client user rr add A $(DOMAIN) $(NAME) $(TTL) $(TARGET) $(LOGIN_OPT)
|
||||
run-client-rr-update-a:
|
||||
$(Q)$(LOC)dnsmanager-client user rr update A $(DOMAIN) $(RRID) $(NAME) $(TTL) $(TARGET) $(LOGIN_OPT)
|
||||
run-client-rr-del:; $(Q)$(LOC)dnsmanager-client user rr del $(DOMAIN) $(RRID) $(LOGIN_OPT)
|
||||
run-client-genzones:; $(Q)$(LOC)dnsmanager-client admin genall $(LOGIN_OPT)
|
13
mk/dev.mk
Normal file
13
mk/dev.mk
Normal file
@ -0,0 +1,13 @@
|
||||
print-messages:; cat src/requests/*.cr | ./bin/get-messages.awk
|
||||
print-message-numbers:; make -s print-messages | grep -E "^[0-9]" | sort -n
|
||||
print-messages-no-comments:; make -s print-messages | grep -vE '^[[:blank:]]+#'
|
||||
print-response-messages:; cat src/responses/*.cr | ./bin/get-messages.awk
|
||||
print-response-message-numbers:; make -s print-response-messages | grep -E "^[0-9]" | sort -n
|
||||
print-response-messages-no-comments:; make -s print-response-messages | grep -vE '^[[:blank:]]+#'
|
||||
|
||||
HTTPD_ACCESS_LOGS ?= /tmp/access-dnsmanager-docs.log
|
||||
HTTPD_ADDR ?= 127.0.0.1
|
||||
HTTPD_PORT ?= 9001
|
||||
DIR ?= docs
|
||||
serve-doc:
|
||||
darkhttpd $(DIR) --addr $(HTTPD_ADDR) --port $(HTTPD_PORT) --log $(HTTPD_ACCESS_LOGS)
|
11
mk/setup.mk
Normal file
11
mk/setup.mk
Normal file
@ -0,0 +1,11 @@
|
||||
DBDIR=/tmp/DATA-dnsmanagerd
|
||||
run-dnsmanagerd:
|
||||
$(Q)$(LOC)dnsmanagerd -v $(VERBOSITY) -r $(DBDIR)
|
||||
|
||||
PORT ?= 8082
|
||||
ADDR ?=
|
||||
run-token-handler: bin/token-handler
|
||||
$(Q)$(LOC)token-handler $(PORT) $(ADDR)
|
||||
|
||||
wipe-db:
|
||||
rm -r $(DBDIR)
|
Loading…
Reference in New Issue
Block a user