From 880222a65df4875b5f0f1f1eb1ff4d45e76d1be1 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Fri, 16 Jun 2017 15:38:10 +0200 Subject: [PATCH] Improved makefile --- makefile | 7 ++++++- patches/.gitignore | 6 ++++++ patches/build.sh | 4 ++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 patches/.gitignore create mode 100755 patches/build.sh diff --git a/makefile b/makefile index 92910c33..07ee862c 100644 --- a/makefile +++ b/makefile @@ -5,12 +5,15 @@ GOBUILD=$(GOCMD) build GOINSTALL=$(GOCMD) install GOTEST=$(GOCMD) test BUILDJOBS=@./jobs/build.sh +BUILDPATCHES=@./patches/build.sh IPTABLES=@sudo iptables server: $(GOBUILD) jobs: $(BUILDJOBS) +patches: + $(BUILDPATCHES) install: $(GOINSTALL) test: @@ -24,9 +27,11 @@ assets: @pack depslist: $(GOCMD) list -f {{.Deps}} | sed -e 's/\[//g' -e 's/\]//g' | tr " " "\n" +clean: + find . -type f | xargs file | grep "ELF.*executable" | awk -F: '{print $1}' | rm ports: $(IPTABLES) -t nat -A OUTPUT -o lo -p tcp --dport 80 -j REDIRECT --to-port 4000 $(IPTABLES) -t nat -A OUTPUT -o lo -p tcp --dport 443 -j REDIRECT --to-port 4001 -all: assets server jobs ports +all: assets server jobs patches ports .PHONY: jobs \ No newline at end of file diff --git a/patches/.gitignore b/patches/.gitignore new file mode 100644 index 00000000..fc45ff68 --- /dev/null +++ b/patches/.gitignore @@ -0,0 +1,6 @@ +* +!*/ +!*.go +!*.sh +!README.md +!.gitignore \ No newline at end of file diff --git a/patches/build.sh b/patches/build.sh new file mode 100755 index 00000000..0f817f6e --- /dev/null +++ b/patches/build.sh @@ -0,0 +1,4 @@ +#!/bin/sh +MYDIR="$(dirname "$(realpath "$0")")" +cd "$MYDIR" +for dir in ./*; do ([ -d "$dir" ] && cd "$dir" && echo "Building $dir" && go build); done \ No newline at end of file