From: ametama Date: Wed, 17 Dec 2025 21:51:03 +0000 (+0100) Subject: build: Makefile to generate compile_flags.txt for clangd X-Git-Url: https://git.wafflesoft.org/?a=commitdiff_plain;h=101e177da35f331201a359d37c362ccc70d103bf;p=cgo.git build: Makefile to generate compile_flags.txt for clangd --- diff --git a/.gitignore b/.gitignore index 240b3f9..9596310 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -opt +apso compile_flags.txt diff --git a/Makefile b/Makefile index d93f90f..0a4bff3 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,8 @@ -opt: src/particle_swarm.c src/vector.c - gcc -Iinclude `pkg-config --cflags gtk4` -lm -fopenmp src/vector.c src/particle_swarm.c -o opt `pkg-config --libs gtk4` +all: compile_flags executable + +compile_flags: + echo "-Iinclude `pkg-config --cflags gtk4` -lm -fopenmp `pkg-config --libs gtk4`" | perl -pe 's|(-.*?)\s|\1\n|g' > compile_flags.txt + echo "-o apso" >> compile_flags.txt + +executable: $(wildcard src/*.c) + gcc $(shell cat compile_flags.txt) $(shell ls src/*.c)