1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
EXEC = $(shell basename $$(pwd)) CC = gcc CFLAGS = -std=gnu11 -O3 -Wall -Wextra -Wpedantic -Wstrict-aliasing SRC = $(wildcard *.c) OBJ = $(SRC:.c=.o) all: $(EXEC) ${EXEC}: $(OBJ) $(CC) -o $@ $^ $(LDFLAGS) %.o: %.c $(CC) -o $@ -c $< $(CFLAGS) .PHONY: clean mrproper clean: @rm -rf *.o mrproper: clean @rm -rf $(EXEC)