11# Paths to packages
22GO =$(shell which go)
3- NPM =$(shell which npm)
43
54# Paths to locations, etc
6- BUILD_DIR := " build"
5+ BUILD_DIR := build
76PLUGIN_DIR := $(wildcard plugin/* )
8- NPM_DIR := $(wildcard npm/* )
97CMD_DIR := $(filter-out cmd/README.md, $(wildcard cmd/* ) )
8+ SQLITE_DIR := ./c
109
1110# Build flags
1211BUILD_MODULE = "github.com/mutablelogic/go-sqlite"
@@ -15,32 +14,26 @@ BUILD_LD_FLAGS += -X $(BUILD_MODULE)/pkg/config.GitTag=$(shell git describe --ta
1514BUILD_LD_FLAGS += -X $(BUILD_MODULE ) /pkg/config.GitBranch=$(shell git name-rev HEAD --name-only --always)
1615BUILD_LD_FLAGS += -X $(BUILD_MODULE ) /pkg/config.GitHash=$(shell git rev-parse HEAD)
1716BUILD_LD_FLAGS += -X $(BUILD_MODULE ) /pkg/config.GoBuildTime=$(shell date -u '+% Y-% m-% dT% H:% M:% SZ')
18- BUILD_FLAGS = -ldflags "-s -w $( BUILD_LD_FLAGS ) "
17+ BUILD_FLAGS = -ldflags "-s -w ${ BUILD_LD_FLAGS} "
1918BUILD_VERSION = $(shell git describe --tags)
2019BUILD_ARCH = $(shell $(GO ) env GOARCH)
2120BUILD_PLATFORM = $(shell $(GO ) env GOOS)
2221
23- all : clean server plugins npm cmd
22+ all : clean server plugins cmd
2423
25- server : dependencies mkdir
24+ server : dependencies
2625 @echo Build server
2726 @${GO} build -o ${BUILD_DIR} /server ${BUILD_FLAGS} github.com/mutablelogic/go-server/cmd/server
2827
29- plugins : $(PLUGIN_DIR )
28+ plugins : dependencies $(PLUGIN_DIR )
3029 @echo Build plugin httpserver
3130 @${GO} build -buildmode=plugin -o ${BUILD_DIR} /httpserver.plugin ${BUILD_FLAGS} github.com/mutablelogic/go-server/plugin/httpserver
3231 @echo Build plugin log
3332 @${GO} build -buildmode=plugin -o ${BUILD_DIR} /log.plugin ${BUILD_FLAGS} github.com/mutablelogic/go-server/plugin/log
3433 @echo Build plugin static
3534 @${GO} build -buildmode=plugin -o ${BUILD_DIR} /static.plugin ${BUILD_FLAGS} github.com/mutablelogic/go-server/plugin/static
3635
37- npm : $(NPM_DIR )
38-
39- cmd : dependencies mkdir $(CMD_DIR )
40-
41- $(NPM_DIR ) : FORCE
42- @echo Build npm $(notdir $@ )
43- @cd $@ && ${NPM} run build
36+ cmd : dependencies $(CMD_DIR )
4437
4538$(CMD_DIR ) : FORCE
4639 @echo Build cmd $(notdir $@ )
@@ -70,19 +63,21 @@ test:
7063 @echo Test pkg/sqobj
7164 @${GO} test ./pkg/sqobj
7265
73-
74- dependencies :
66+ dependencies : sqlite3 mkdir
7567ifeq (,${GO})
7668 $(error "Missing go binary")
7769endif
78- ifeq (,${NPM})
79- $(error "Missing npm binary")
80- endif
70+
71+ sqlite3 :
72+ @ $( MAKE ) -C ${SQLITE_DIR}
8173
8274mkdir :
8375 @install -d ${BUILD_DIR}
8476
8577clean :
78+ @echo Clean
8679 @rm -fr $(BUILD_DIR )
8780 @${GO} mod tidy
8881 @${GO} clean
82+ @$(MAKE ) -C ${SQLITE_DIR} clean
83+
0 commit comments