Skip to content

Commit

Permalink
chore: Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
littlebutt committed Jan 24, 2023
1 parent dadef94 commit f788563
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 4 deletions.
42 changes: 38 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,45 @@
all: test run
GO ?= go
HAS_GO = $(shell hash $(GO) > /dev/null 2>&1 && echo "GO" || echo "NOGO")
SQLITE3 ?= sqlite3
HAS_SQLITE3 = $(shell hash $(SQLITE3) > /dev/null 2>&1 && echo "SQLITE3" || echo "NOSQLITE3")

build:
go build github.com/littlebutt/nasu/src
ifeq ($(OS), Windows_NT)
GOFLAGS := -v -buildmode=exe
EXECUTABLE ?= nasu.exe
else ifeq ($(OS), Windows)
GOFLAGS := -v -buildmode=exe
EXECUTABLE ?= nasu.exe
else
GOFLAGS := -v
EXECUTABLE ?= nasu
endif

.PHONY: all

all: check-env run

check-env:
@echo "checking go..."
ifeq ($(HAS_GO), NOGO)
@echo "GO is not installed"
exit -1
else
@echo "GO is installed"
endif
@echo "checking sqlite3..."
ifeq ($(HAS_SQLITE3), NOSQLITE3)
@echo "sqlite3 is not installed"
exit -1
else
@echo "sqlite3 is installed"
endif

build: check-env
go build -o $(EXECUTABLE) github.com/littlebutt/nasu/src

test:
go test -cover ./...

run:
run: check-env
go run github.com/littlebutt/nasu/src

13 changes: 13 additions & 0 deletions web/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

build: clean
npm run build
mv build/index.html build/index.htm #go default behaviour
mv build ../src/web

clean:
rm -rf ../src/web


run:
npm run start

0 comments on commit f788563

Please sign in to comment.