diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9ec6301 --- /dev/null +++ b/Makefile @@ -0,0 +1,42 @@ +FPC ?= fpc +SRCDIR := src +TESTDIR := tests +BUILDDIR := build +UNITDIR := $(BUILDDIR)/units +LINTDIR := $(BUILDDIR)/lint +TESTBIN := $(BUILDDIR)/testcepis + +FPCFLAGS ?= -O2 -vewn -Fu$(SRCDIR) +LINTFLAGS ?= -Sew -vewnh -Fu$(SRCDIR) + +.DEFAULT_GOAL := help +.PHONY: help build test lint check clean + +help: + @echo 'Targets:' + @echo ' build compile the units into $(UNITDIR)' + @echo ' test compile and run the suite against a local HTTP server' + @echo ' lint compile with warnings as errors, into a scratch dir' + @echo ' check lint + test + build, in that order' + @echo ' clean remove $(BUILDDIR)' + @echo + @echo 'Override the compiler with e.g. make build FPC=ppcx64' + +build: + @mkdir -p $(UNITDIR) + $(FPC) $(FPCFLAGS) -FU$(UNITDIR) $(SRCDIR)/Cepis.pas + +test: + @mkdir -p $(UNITDIR) + $(FPC) $(FPCFLAGS) -FU$(UNITDIR) -FE$(BUILDDIR) -otestcepis $(TESTDIR)/TestCepis.pas + ./$(TESTBIN) --all --format=plain + +lint: + @mkdir -p $(LINTDIR) + $(FPC) $(LINTFLAGS) -FU$(LINTDIR) $(SRCDIR)/Cepis.pas + $(FPC) $(LINTFLAGS) -FU$(LINTDIR) -FE$(LINTDIR) -otestcepis $(TESTDIR)/TestCepis.pas + +check: lint test build + +clean: + rm -rf $(BUILDDIR) |