Set up compile_commands.json generation

This commit is contained in:
Gvidas Juknevičius 2024-05-19 15:58:35 +03:00
parent 489c60f220
commit df4c777bed
Signed by: MCorange
GPG Key ID: 12B1346D720B7FBB
3 changed files with 28 additions and 12 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
modules/*
.cache/
dim
compile_commands.json

26
Makefile Normal file
View File

@ -0,0 +1,26 @@
BIN=./dim
CC=gcc
CCARGS=-Isrc/include -Wall -pedantic
MODULES= \
modules/clock.dim \
modules/battery.dim\
all: $(BIN) $(MODULES) compile_commands.json
$(BIN): src/main.c src/plug.c
$(CC) -o $@ $^ $(CCARGS) -lX11 -ldl
modules/%.dim: src/modules/%.c
$(CC) -o $@ $^ -rdynamic -shared -fPIC $(CCARGS)
compile_commands.json:
compiledb -n make

View File

@ -1,11 +0,0 @@
#!/usr/bin/bash
set -xe
CCARGS="-Isrc/include -Wall -pedantic"
cc -o dim src/main.c src/plug.c $CCARGS -lX11 -ldl
cc -o modules/clocky.dim src/modules/clock.c -rdynamic -shared -fPIC $CCARGS
cc -o modules/battery.dim src/modules/battery.c -rdynamic -shared -fPIC $CCARGS