dnsmanager/Makefile

112 lines
3.2 KiB
Makefile
Raw Permalink Normal View History

2024-03-23 11:47:05 +01:00
all: build-server
# For requests where authentication is required.
LOGIN ?=
ifeq ($(LOGIN),)
LOGIN_OPT =
else
LOGIN_OPT = -l $(LOGIN)
endif
2023-05-08 21:42:05 +02:00
# No idea why, but I need that to run applications. Ignore that.
2023-06-27 20:31:02 +02:00
#LD_P ?= LD_PRELOAD=/usr/local/lib/libipc.so.0
OPTS ?= --progress
2024-03-17 05:41:50 +01:00
2023-06-27 20:31:02 +02:00
Q ?= @
2023-05-08 21:42:05 +02:00
SHOULD_UPDATE = ./bin/should-update
####################
### REQUEST EXAMPLES
####################
2023-05-08 21:42:05 +02:00
DOMAIN ?= example.com
2023-06-28 02:26:12 +02:00
build-write-zone-file: tools/write-zone-file.cr
2024-03-17 05:41:50 +01:00
$(Q)-([ ! -f bin/write-zone-file ] || [ tools/write-zone-file.cr -nt bin/write-zone-file ]) && shards build write-zone-file $(OPTS)
2023-06-28 02:26:12 +02:00
zone-file: build-write-zone-file
$(Q)./bin/write-zone-file $(DOMAIN)
build-write-template-zone-file: tools/write-template-zone-file.cr
2024-03-17 05:41:50 +01:00
$(Q)-([ ! -f bin/write-template-zone-file ] || [ tools/write-template-zone-file.cr -nt bin/write-template-zone-file ]) && shards build write-template-zone-file $(OPTS)
2023-06-28 02:26:12 +02:00
zone-basic-template-file: build-write-template-zone-file
$(Q)./bin/write-template-zone-file $(DOMAIN)
2023-05-08 21:42:05 +02:00
VERBOSITY ?= 4
run-client-verbosity:
2023-06-27 20:31:02 +02:00
$(Q)$(LD_P) ./bin/dnsmanager-client admin maintenance verbosity $(VERBOSITY) $(LOGIN_OPT)
2023-05-08 21:42:05 +02:00
2023-06-27 13:00:26 +02:00
run-client-domain-add:
2023-06-27 20:31:02 +02:00
$(Q)$(LD_P) ./bin/dnsmanager-client user domain add $(DOMAIN) $(LOGIN_OPT)
2023-06-27 13:00:26 +02:00
run-client-domain-del:
2023-06-27 20:31:02 +02:00
$(Q)$(LD_P) ./bin/dnsmanager-client user domain del $(DOMAIN) $(LOGIN_OPT)
2023-06-27 13:00:26 +02:00
2023-06-27 13:06:05 +02:00
run-client-domain-list:
2023-06-27 20:31:02 +02:00
$(Q)$(LD_P) ./bin/dnsmanager-client user domain list $(LOGIN_OPT)
2023-06-27 13:06:05 +02:00
2023-05-08 21:42:05 +02:00
run-client-zone-add:
2023-06-27 20:31:02 +02:00
$(Q)$(LD_P) ./bin/dnsmanager-client user zone add $(DOMAIN).json $(LOGIN_OPT)
2023-05-08 21:42:05 +02:00
2023-06-27 13:06:05 +02:00
run-client-zone-get:
2023-06-27 20:31:02 +02:00
$(Q)$(LD_P) ./bin/dnsmanager-client user zone get $(DOMAIN) $(LOGIN_OPT)
2023-06-27 13:06:05 +02:00
2023-05-08 21:42:05 +02:00
RRID ?= 1
NAME ?=
TTL ?= 3600
TARGET ?=
run-client-rr-add-a:
2023-06-27 20:31:02 +02:00
$(Q)$(LD_P) ./bin/dnsmanager-client user rr add A $(DOMAIN) $(NAME) $(TTL) $(TARGET) $(LOGIN_OPT)
2023-06-16 00:06:14 +02:00
2023-05-08 21:42:05 +02:00
run-client-rr-update-a:
2023-06-27 20:31:02 +02:00
$(Q)$(LD_P) ./bin/dnsmanager-client user rr update A $(DOMAIN) $(RRID) $(NAME) $(TTL) $(TARGET) $(LOGIN_OPT)
2023-05-08 21:42:05 +02:00
run-client-rr-del:
2023-06-27 20:31:02 +02:00
$(Q)$(LD_P) ./bin/dnsmanager-client user rr del $(DOMAIN) $(RRID) $(LOGIN_OPT)
2023-05-08 21:42:05 +02:00
run-admin-generate-all-zonefiles:
$(Q)$(LD_P) ./bin/dnsmanager-client admin genall $(LOGIN_OPT)
##################
### SETUP COMMANDS
##################
2023-05-08 21:42:05 +02:00
2023-07-07 20:23:06 +02:00
DBDIR=/tmp/DATA-dnsmanagerd
2023-05-08 21:42:05 +02:00
run-dnsmanagerd:
2023-07-07 20:23:06 +02:00
$(Q)$(LD_P) ./bin/dnsmanagerd -v $(VERBOSITY) -r $(DBDIR)
2024-03-14 23:11:51 +01:00
PORT ?= 8082
ADDR ?=
run-token-handler:
$(Q)$(LD_P) ./bin/token-handler $(PORT) $(ADDR)
build-server:
2024-03-17 05:41:50 +01:00
$(Q)-$(SHOULD_UPDATE) bin/dnsmanagerd && shards build dnsmanagerd $(OPTS)
build-client:
2024-03-17 05:41:50 +01:00
$(Q)-$(SHOULD_UPDATE) bin/dnsmanager-client && shards build dnsmanager-client $(OPTS)
build-token-handler:
2024-03-17 05:41:50 +01:00
$(Q)shards build token-handler $(OPTS)
build: build-server build-client build-token-handler
2023-06-15 13:06:55 +02:00
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-without-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-without-comments:
make -s print-response-messages | grep -vE '^[[:blank:]]+#'
2023-07-07 20:23:06 +02:00
wipe-db:
2023-07-07 20:23:06 +02:00
rm -r $(DBDIR)
release:
2024-06-01 03:35:53 +02:00
make build-server OPTS="--release --progress --no-debug"