blob: ef68255c8b9c238421df19125391b6c3c717915c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
SHELL := /bin/bash
SOURCE_DIR := scribbled
WATCH_FILES := $(shell find -type f -iname "*.go" -or -iname "*.html")
GO_FILES := $(shell find $(SOURCE_DIR) -type f -iname "*.go")
APP := scribbled
PID := /tmp/scribbled.pid
CONFIG_FILE := config.json
TEMPLATE_DIR := templates
all: run build serve
build: $(APP)
cd $(SOURCE_DIR) && go build -o $(APP)
$(APP) := $(GO_FILES)
run: kill $(CONFIG_FILE)
@#PORT=8765 $(SOURCE_DIR)/$(APP) -config $(CONFIG_FILE) & echo $$! > $(PID)
@$(SOURCE_DIR)/$(APP) -config $(CONFIG_FILE) & echo $$! > $(PID)
kill:
@kill `cat $(PID)` 2>/dev/null || true
serve:
@#@while true; do inotifywait -r -e modify $(WATCH_FILES) && make restart; done
@while true; do inotifywait --excludei ".*\.swp" -r -e modify $(SOURCE_DIR) $(TEMPLATE_DIR) 1>/dev/null 2>&1 && make restart 1>/dev/null; done
restart: kill run
@echo "Restartet $(APP)"
config:
$(SOURCE_DIR)/$(APP) -genconfig $(CONFIG_FILE)
$(CONFIG_FILE):
$(SOURCE_DIR)/$(APP) -genconfig $(CONFIG_FILE)
clean:
$(RM) $(RMFLAGS) $(SOURCE_DIR)/$(APP)
.PHONY: $(APP)
|