31 lines
463 B
Plaintext
31 lines
463 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
|
|
|
|
bear: clean
|
|
bear -- make
|
|
|
|
run: $1
|
|
./$<
|
|
|
|
endsnippet
|