Skip to content

Instantly share code, notes, and snippets.

@scriptum
Created September 9, 2013 13:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scriptum/6495528 to your computer and use it in GitHub Desktop.
Save scriptum/6495528 to your computer and use it in GitHub Desktop.
Simplest universal Makefile for *.c single file apps
CFLAGS += -O2 -pipe -Wall -Wextra
LDFLAGS += -lm
HEADERS = $(wildcard *.h)
SOURCES = $(wildcard *.c)
TARGETS := $(SOURCES:.c=)
all: $(TARGETS)
% : %.c $(HEADERS)
$(CC) $(CFLAGS) $(LDFLAGS) -o "$@" "$<"
clean:
echo rm -f $(TARGETS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment