summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 9ec63019e5d8db9b9253ee68802394d99060bb56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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)