diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b5b86a7 --- /dev/null +++ b/Makefile @@ -0,0 +1,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 serve + +build: $(APP) + cd $(SOURCE_DIR) && go build -o $(APP) + +$(APP) := $(GO_FILES) + +run: kill build $(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) |
