summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorAlbert Cervin <albert@acervin.com>2024-01-29 23:34:07 +0100
committerAlbert Cervin <albert@acervin.com>2024-01-30 15:04:44 +0100
commitdda591fa33ac10c433289aa3ee862c3ded41eed3 (patch)
tree9a25edbc810fd5d8fbc20f367c71ebcd81bb6026 /Makefile
parent880199011075afd4f2d9bd16c7ce42a04741b5b7 (diff)
downloaddged-dda591fa33ac10c433289aa3ee862c3ded41eed3.tar.gz
dged-dda591fa33ac10c433289aa3ee862c3ded41eed3.tar.xz
dged-dda591fa33ac10c433289aa3ee862c3ded41eed3.zip
Syntax highlight is a go
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile22
1 files changed, 20 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 94d807e..9b592b5 100644
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,8 @@
.OBJDIR: ./build
.PHONY: default clean check run debug debug-tests install format
+SYNTAX_ENABLE ?= true
+
default: dged
build:
@@ -26,12 +28,24 @@ TEST_SOURCES = test/assert.c test/buffer.c test/text.c test/utf8.c test/main.c \
test/command.c test/keyboard.c test/fake-reactor.c test/allocator.c \
test/minibuffer.c test/undo.c test/settings.c test/container.c
-prefix ?= "/usr"
+prefix ?= /usr
+datadir = $(prefix)/share/dged
.SUFFIXES:
.SUFFIXES: .c .o .d
-CFLAGS += -Werror -g -std=c99 -I $(.CURDIR)/src -I $(.CURDIR)/src/main
+CFLAGS += -Werror -g -O2 -std=c99 -I $(.CURDIR)/src -I $(.CURDIR)/src/main -DDATADIR="$(datadir)"
+
+.if $(SYNTAX_ENABLE:tl) == true
+HEADERS += src/dged/syntax.h
+SOURCES += src/dged/syntax.c
+
+treesitterflags != pkg-config tree-sitter --cflags
+CFLAGS += ${treesitterflags} -DSYNTAX_ENABLE
+
+treesitterld != pkg-config tree-sitter --libs
+LDFLAGS += ${treesitterld}
+.endif
UNAME_S != uname -s | tr '[:upper:]' '[:lower:]'
.sinclude "$(UNAME_S).mk"
@@ -90,6 +104,10 @@ install: dged
install -d $(prefix)/share/man/man1
install -m 644 $(.CURDIR)/dged.1 $(prefix)/share/man/man1/dged.1
+ if [ -n "$$TREESITTER_GRAMMARS" ]; then\
+ install -d "$(datadir)";\
+ cp -rL "$$TREESITTER_GRAMMARS"/ "$(datadir)/grammars";\
+ fi
docs:
doxygen $(.CURDIR)/Doxyfile