Skip to content

Commit 15235ee

Browse files
committed
Added make cmd
1 parent 1127ef7 commit 15235ee

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

Makefile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ GO=$(shell which go)
33
NPM=$(shell which npm)
44

55
# Paths to locations, etc
6-
BUILD_DIR = "build"
7-
PLUGIN_DIR = $(wildcard plugin/*)
8-
NPM_DIR = $(wildcard npm/*)
6+
BUILD_DIR := "build"
7+
PLUGIN_DIR := $(wildcard plugin/*)
8+
NPM_DIR := $(wildcard npm/*)
9+
CMD_DIR := $(filter-out cmd/README.md, $(wildcard cmd/*))
910

1011
# Build flags
1112
BUILD_MODULE = "github.com/djthorpe/go-server"
@@ -16,20 +17,26 @@ BUILD_LD_FLAGS += -X $(BUILD_MODULE)/pkg/config.GitHash=$(shell git rev-parse HE
1617
BUILD_LD_FLAGS += -X $(BUILD_MODULE)/pkg/config.GoBuildTime=$(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
1718
BUILD_FLAGS = -ldflags "-s -w $(BUILD_LD_FLAGS)"
1819

19-
.PHONY: all test server npm plugins dependencies mkdir clean
20+
.PHONY: all test server npm cmd plugins dependencies mkdir clean
2021

21-
all: clean plugins server npm
22+
all: clean plugins server npm cmd
2223

2324
server: dependencies mkdir
2425
@echo Build server
2526
@${GO} build -o ${BUILD_DIR}/server ${BUILD_FLAGS} github.com/djthorpe/go-server/cmd/server
2627

2728
npm: $(NPM_DIR)
2829

30+
cmd: dependencies mkdir $(CMD_DIR)
31+
2932
$(NPM_DIR): FORCE
3033
@echo Build npm $(notdir $@)
3134
@cd $@ && ${NPM} run build
3235

36+
$(CMD_DIR): FORCE
37+
@echo Build cmd $(notdir $@)
38+
@${GO} build -o ${BUILD_DIR}/$(notdir $@) ${BUILD_FLAGS} ./$@
39+
3340
plugins: $(PLUGIN_DIR)
3441
@echo Build plugin httpserver
3542
@${GO} build -buildmode=plugin -o ${BUILD_DIR}/httpserver.plugin ${BUILD_FLAGS} github.com/djthorpe/go-server/plugin/httpserver

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ Presently the module is in development and the API is subject to change.
2020
|--------------------------------------|-----------------|---------------|
2121
| Use the lower-level sqlite3 bindings similar to the [C API](https://www.sqlite.org/capi3ref.html) | [sys/sqlite3](https://github.com/djthorpe/go-sqlite/tree/master/sys/sqlite3) | [README.md](https://github.com/djthorpe/go-sqlite/blob/master/sys/sqlite3/README.md) |
2222
| Use high-concurrency high-level interface including statement caching and connection pool | [pkg/sqlite3](https://github.com/djthorpe/go-sqlite/tree/master/pkg/sqlite3) | [README.md](https://github.com/djthorpe/go-sqlite/blob/master/pkg/sqlite3/README.md) |
23-
| Implement a REST API to sqlite3 | [plugin/sqlite3](https://github.com/djthorpe/go-sqlite/tree/master/plugin/sqlite3) | [README.md](https://github.com/djthorpe/go-sqlite/blob/master/plugin/sqlite3/README.md) |
24-
| Develop a front-end web service to the REST API backend | [npm/sqlite3](https://github.com/djthorpe/go-sqlite/tree/master/npm/sqlite3) | [README.md](https://github.com/djthorpe/go-sqlite/blob/master/npm/sqlite3/README.md) |
23+
| Implement or use a REST API to sqlite3 | [plugin/sqlite3](https://github.com/djthorpe/go-sqlite/tree/master/plugin/sqlite3) | [README.md](https://github.com/djthorpe/go-sqlite/blob/master/plugin/sqlite3/README.md) |
24+
| Develop or use a front-end web service to the REST API backend | [npm/sqlite3](https://github.com/djthorpe/go-sqlite/tree/master/npm/sqlite3) | [README.md](https://github.com/djthorpe/go-sqlite/blob/master/npm/sqlite3/README.md) |
2525
| Use an "object" interface to persist structured data | [pkg/sqobj](https://github.com/djthorpe/go-sqlite/tree/master/pkg/sqobj) | [README.md](https://github.com/djthorpe/go-sqlite/blob/master/pkg/sqobj/README.md) |
2626
| Use a statement builder to programmatically write SQL statements | [pkg/lang](https://github.com/djthorpe/go-sqlite/tree/master/pkg/lang) | [README.md](https://github.com/djthorpe/go-sqlite/blob/master/pkg/lang/README.md) |
27-
| Implement a generalized data importer from CSV, JSON, etc | [pkg/importer](https://github.com/djthorpe/go-sqlite/tree/master/pkg/importer) | [README.md](https://github.com/djthorpe/go-sqlite/blob/master/pkg/importer/README.md) |
27+
| Implement a generalized data importer from CSV, JSON, Excel, etc | [pkg/importer](https://github.com/djthorpe/go-sqlite/tree/master/pkg/importer) | [README.md](https://github.com/djthorpe/go-sqlite/blob/master/pkg/importer/README.md) |
2828
| Implement a search indexer | [pkg/indexer](https://github.com/djthorpe/go-sqlite/tree/master/pkg/indexer) | [README.md](https://github.com/djthorpe/go-sqlite/blob/master/pkg/indexer/README.md) |
2929
| Tokenize SQL statements for syntax colouring (for example) | [pkg/tokenizer](https://github.com/djthorpe/go-sqlite/tree/master/pkg/tokenizer) | [README.md](https://github.com/djthorpe/go-sqlite/blob/master/pkg/tokenizer/README.md) |
3030
| See example command-line tools | [cmd](https://github.com/djthorpe/go-sqlite/tree/master/cmd) | [README.md](https://github.com/djthorpe/go-sqlite/blob/master/cmd/README.md) |
@@ -79,6 +79,7 @@ the package. The various make targets are:
7979

8080
* `make all` will perform tests, build all examples, the backend API and the frontend web application;
8181
* `make test` will perform tests;
82+
* `make cmd` will build example command-line tools into the `build` folder;
8283
* `make server plugins` will install the backend server and required plugins in the `build` folder;
8384
* `make npm` will compile the frontend web application in a 'dist' folder for each npm module located in the `npm` folder;
8485
* `make clean` will remove all build artifacts.

0 commit comments

Comments
 (0)