From 101e177da35f331201a359d37c362ccc70d103bf Mon Sep 17 00:00:00 2001 From: ametama Date: Wed, 17 Dec 2025 22:51:03 +0100 Subject: [PATCH] build: Makefile to generate compile_flags.txt for clangd --- .gitignore | 2 +- Makefile | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) 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) -- 2.34.1