Makefile (460B)
1 NAME=$(shell basename ${PWD}) 2 SDL2FLAGS=$(shell pkg-config --cflags sdl2 SDL2_image SDL2_ttf) 3 CFLAGS?=-std=c99 -Wall -Wextra -pedantic -I. -Og -g 4 LDFLAGS?=$(shell pkg-config --libs sdl2 SDL2_image SDL2_ttf) 5 SRC=$(wildcard *.c) 6 DEPS:=$(wildcard *.h) 7 OBJ:=$(SRC:.c=.o) 8 9 all: $(NAME) 10 11 .PHONY: clean 12 13 clean: 14 rm -f $(OBJ) $(NAME) 15 16 %.o : %.c $(DEPS) 17 $(CC) $(CFLAGS) $(SDL2FLAGS) -c $< -o $@ 18 19 $(NAME): $(OBJ) 20 $(CC) $(OBJ) -o $@ $(LDFLAGS) 21 22 run: $(NAME) 23 ./$(NAME)