aboutsummaryrefslogtreecommitdiff
path: root/build.ninja
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-05-23 17:38:23 -0700
committerFuwn <[email protected]>2024-05-23 17:38:23 -0700
commita40c51b0020ecc743c88d81140714d37ed3cc3b1 (patch)
tree2111c04433ad74827caf1cc7bc008cd7a88e795a /build.ninja
parentfix(dwm.c): correct vertical padding on first paint (diff)
downloadseiwm-a40c51b0020ecc743c88d81140714d37ed3cc3b1.tar.xz
seiwm-a40c51b0020ecc743c88d81140714d37ed3cc3b1.zip
build: switch to ninja
Diffstat (limited to 'build.ninja')
-rw-r--r--build.ninja62
1 files changed, 62 insertions, 0 deletions
diff --git a/build.ninja b/build.ninja
new file mode 100644
index 0000000..6c224f1
--- /dev/null
+++ b/build.ninja
@@ -0,0 +1,62 @@
+ninja_required_version = 1.10
+builddir = ./build
+
+include config.ninja
+
+rule install
+ command = mkdir -p ${DESTDIR}${PREFIX}/bin && $
+ install -Dm755 ./sei ${DESTDIR}${PREFIX}/bin && $
+ mkdir -p ${DESTDIR}${PREFIX}/share/sei && $
+ cp -f sei.desktop /usr/share/xsessions/sei.desktop
+
+rule uninstall
+ command = rm -f ${DESTDIR}${PREFIX}/bin/sei $
+ /usr/share/xsessions/sei.desktop
+
+rule options
+ command = echo "CFLAGS = ${CFLAGS}" && $
+ echo "LDFLAGS = ${LDFLAGS}" && $
+ echo "CC = ${CC}"
+
+rule clean
+ command = ninja $FILE_ARG -t clean $TARGETS
+
+rule compile
+ command = ${CC} -c ${in} -o ${out} ${CFLAGS} -MMD -MF ${out}.d
+ depfile = ${out}.d
+
+rule link
+ command = ${CC} ${in} -o ${out} ${LDFLAGS}
+
+rule clang_format
+ command = clang-format -i -style=LLVM ./*.{c,h}
+
+rule clang_tidy
+ command = ninja -t compdb > compile_commands.json && clang-tidy ./*.{c,h}
+
+build format: clang_format
+
+build tidy: clang_tidy
+
+build clean: clean
+
+build all: phony options sei
+
+build options: options
+ pool = console
+
+build ${builddir}/drw.o: compile drw.c
+build ${builddir}/dwm.o: compile dwm.c
+build ${builddir}/util.o: compile util.c
+
+build sei: link ${builddir}/drw.o ${builddir}/dwm.o ${builddir}/util.o
+
+build install: install sei
+ pool = console
+ restat = 1
+
+build uninstall: uninstall
+ pool = console
+ restat = 1
+
+default sei