mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-22 09:00:10 +00:00
build: dont go build when INTERNAL=off and no changes
all build steps (apart from swagger, which generates go code) are stored in BUILDDEPS, which is now a dependency of all. if INTERNAL=on, BUILDDEPS is added to GO_TARGET, so the executable is rebuilt with new content. Used the .DEFAULT_GOAL feature so I could move all: to the bottom, where I think it belongs.
This commit is contained in:
parent
6347495b5b
commit
1aa100dc7d
19
Makefile
19
Makefile
@ -1,6 +1,5 @@
|
|||||||
.PHONY: configuration email typescript swagger copy compile compress inline-css variants-html install clean npm config-description config-default precompile
|
.PHONY: configuration email typescript swagger copy compile compress inline-css variants-html install clean npm config-description config-default precompile
|
||||||
|
.DEFAULT_GOAL := all
|
||||||
all: compile
|
|
||||||
|
|
||||||
GOESBUILD ?= off
|
GOESBUILD ?= off
|
||||||
ifeq ($(GOESBUILD), on)
|
ifeq ($(GOESBUILD), on)
|
||||||
@ -35,9 +34,11 @@ TAGS := -tags "
|
|||||||
|
|
||||||
ifeq ($(INTERNAL), on)
|
ifeq ($(INTERNAL), on)
|
||||||
DATA := data
|
DATA := data
|
||||||
|
COMPDEPS := $(BUILDDEPS)
|
||||||
else
|
else
|
||||||
DATA := build/data
|
DATA := build/data
|
||||||
TAGS := $(TAGS) external
|
TAGS := $(TAGS) external
|
||||||
|
COMPDEPS :=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(TRAY), on)
|
ifeq ($(TRAY), on)
|
||||||
@ -206,21 +207,27 @@ $(COPY_TARGET): $(INLINE_TARGET) $(STATIC_SRC) $(LANG_SRC)
|
|||||||
cp -r lang $(DATA)/
|
cp -r lang $(DATA)/
|
||||||
cp LICENSE $(DATA)/
|
cp LICENSE $(DATA)/
|
||||||
|
|
||||||
precompile: $(DATA) $(CONFIG_DEFAULT) $(EMAIL_TARGET) $(COPY_TARGET) $(SWAGGER_TARGET)
|
BUILDDEPS := $(DATA) $(CONFIG_DEFAULT) $(EMAIL_TARGET) $(COPY_TARGET) $(SWAGGER_TARGET)
|
||||||
|
precompile: $(BUILDDEPS)
|
||||||
|
|
||||||
|
COMPDEPS =
|
||||||
|
ifeq ($(INTERNAL), on)
|
||||||
|
COMPDEPS = $(BUILDDEPS)
|
||||||
|
endif
|
||||||
|
|
||||||
GO_SRC = $(shell find ./ -name "*.go")
|
GO_SRC = $(shell find ./ -name "*.go")
|
||||||
GO_TARGET = build/jfa-go
|
GO_TARGET = build/jfa-go
|
||||||
$(GO_TARGET): $(DATA) $(CONFIG_DEFAULT) $(EMAIL_TARGET) $(COPY_TARGET) $(SWAGGER_TARGET) $(GO_SRC) go.mod go.sum
|
$(GO_TARGET): $(COMPDEPS) $(SWAGGER_TARGET) $(GO_SRC) go.mod go.sum
|
||||||
$(info Downloading deps)
|
$(info Downloading deps)
|
||||||
$(GOBINARY) mod download
|
$(GOBINARY) mod download
|
||||||
$(info Building)
|
$(info Building)
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
$(GOBINARY) build $(RACEDETECTOR) -ldflags="$(LDFLAGS)" $(TAGS) -o $(GO_TARGET)
|
$(GOBINARY) build $(RACEDETECTOR) -ldflags="$(LDFLAGS)" $(TAGS) -o $(GO_TARGET)
|
||||||
|
|
||||||
compile: $(GO_TARGET)
|
all: $(BUILDDEPS) $(GO_TARGET)
|
||||||
|
|
||||||
compress:
|
compress:
|
||||||
upx --lzma build/jfa-go
|
upx --lzma $(GO_TARGET)
|
||||||
|
|
||||||
install:
|
install:
|
||||||
cp -r build $(DESTDIR)/jfa-go
|
cp -r build $(DESTDIR)/jfa-go
|
||||||
|
Loading…
Reference in New Issue
Block a user