dotfiles/vim/.vim/UltiSnips/make.snippets
2025-01-06 21:22:17 +01:00

35 lines
521 B
Plaintext

snippet base "tonitch's makefile base" b
.PHONY: all clean run
VERSION = 0.0.1
LIBS = $2
CMACRO = -DVERSION=\"$(VERSION)\"
CC = gcc
CFLAGS = -g -Wall -Wextra -pedantic $(shell pkg-config $(LIBS) --cflags) $(CMACRO)
LDFLAGS = $(shell pkg-config $(LIBS) --libs)
all: ${1:${VISUAL:main}}
$1: $1.o
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
$0
clean:
rm -f *.o
rm -f $1
rm -f tags compile_commands.json
bear: clean
bear -- make
tags:
ctags **.{c,h}
run: $1
./$<
endsnippet