summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile43
1 files changed, 21 insertions, 22 deletions
diff --git a/Makefile b/Makefile
index a03ba1c..6f3925b 100644
--- a/Makefile
+++ b/Makefile
@@ -15,6 +15,14 @@ else
VERBOSE:=
endif
+# Allow use of external networks. EXTERNAL=1
+ifdef EXTERNAL
+ EXTERNAL:=-external
+else
+ EXTERNAL:=
+endif
+
+
IMPORT_FILE:=./import.go
APP:=mailer
@@ -31,10 +39,10 @@ all: kill build run
clean: kill
@(rm $(IMPORT_FILE) 2>/dev/null && echo "Removing import file..." ) || true
@(rm $(FREEMAIL_DB_CREDENTIALS) 2>/dev/null echo && "Removing sqlite3 database..." ) || true
-# @(rm ../$(APP).tar.gz 1>&2 2>/dev/null && echo "Removing tar archiv...") || true
+ @(rm $(APP).tar.gz 1>&2 2>/dev/null && echo "Removing tar archiv...") || true
@(rm _env.sh 1>&2 2>/dev/null && echo "Removing _env.sh...") || true
@(rm $(APP) 2>/dev/null && echo "Removing binary ($(APP))...") || true
-# @(rm ../start.sh 1>&2 2>/dev/null && echo "Removing startup script...") || true
+ @(rm start.sh 1>&2 2>/dev/null && echo "Removing startup script...") || true
@echo "Done."
build: import
@@ -44,8 +52,9 @@ run: _test_build
./$(APP) &
kill:
- @echo "Killing running instances..."
- @pkill $(APP) || true
+ @(pgrep $(APP) && \
+ echo "Killing running instances..." && \
+ pkill $(APP) ) || true
create_import:
@if [ ! -f $(IMPORT_FILE) ] ; \
@@ -73,31 +82,21 @@ database_all: sqlite3 mysql postgresql
@echo "Created import file for all databases."
pack: gen_config
- @cd .. && \
echo "#!/bin/sh" > start.sh && \
- echo "cd app && . ./_env.sh && ./$(APP)" >> start.sh && \
+ echo ". ./_env.sh && ./$(APP)" >> start.sh && \
chmod +x start.sh && \
- tar czf $(APP).tar.gz start.sh app/$(APP) app/_env.sh views static $(FREEMAIL_DB_DIR) 2>/dev/null && \
+ tar czf $(APP).tar.gz start.sh $(APP) _env.sh views static $(FREEMAIL_DB_DIR) 2>/dev/null && \
rm start.sh 2>/dev/null && \
- echo "\n../$(APP).tar.gz is ready." || \
+ echo "\n/$(APP).tar.gz is ready." || \
(echo "Run \"make build\" first." && exit 1)
test: import
- FREEMAIL_DB_CREDENTIALS=":memory:" go test $(RACE) $(VERBOSE)
+ FREEMAIL_DB_CREDENTIALS=":memory:" go test $(RACE) $(VERBOSE) $(EXTERNAL)
@(rm $(IMPORT_FILE) 2>/dev/null && echo "Removing import file..." ) || true
-test_all: import
- FREEMAIL_DB_CREDENTIALS=":memory:" go test $(RACE) $(VERBOSE) -v -tags all
-
-test_dependencies: import
- FREEMAIL_DB_CREDENTIALS=":memory:" go test $(RACE) $(VERBOSE) -tags dep
-
-benchmark:
- FREEMAIL_DB_CREDENTIALS=":memory:" go test $(VERBOSE) -bench=".*" -tags general
-
-benchmark_dependencies: import
- export DB_FREEMAIL_LOG=false
- FREEMAIL_DB_CREDENTIALS=":memory:" go test $(VERBOSE) -bench=".*" -tags dep
+benchmark: import
+ DB_FREEMAIL_LOG=false FREEMAIL_DB_CREDENTIALS=":memory:" go test $(VERBOSE) -bench=".*"
+ @(rm $(IMPORT_FILE) 2>/dev/null && echo "Removing import file..." ) || true
_test_build:
@if [ ! -f ./$(APP) ] || [ ! -x ./$(APP) ]; then \
@@ -127,7 +126,7 @@ gen_config: _test_build
echo "export FREEMAIL_SECRET=$(FREEMAIL_SECRET)" >> _env.sh
@echo ""
@echo "# Smtp" >> _env.sh
- echo "export FREEMAIL_SMTP_MAILER=$(FREEMAIL_SMTP_MAILER)" >> _env.sh
+ echo "export FREEMAIL_SMTP_MAILER_MX=$(FREEMAIL_SMTP_MAILER_MX)" >> _env.sh
echo "export FREEMAIL_SMTP_PASSWORD=$(FREEMAIL_SMTP_PASSWORD)" >> _env.sh
echo "export FREEMAIL_SMTP_ADRESS=$(FREEMAIL_SMTP_ADRESS)" >> _env.sh
@chmod +x _env.sh