Skip to content

Instantly share code, notes, and snippets.

@danrl
Created September 24, 2013 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danrl/6686497 to your computer and use it in GitHub Desktop.
Save danrl/6686497 to your computer and use it in GitHub Desktop.
a very generic makefile
# build config
TARGETS = bin1 bin2
INCLUDES = header.h
# project config
CC = gcc
CFLAGS += -Wall -Wextra -pedantic
LDFLAGS +=
# generic build instructions
.PHONY: all clean
.DEFAULT: all
all: $(TARGETS)
${TARGETS}: %: %.o $(INCLUDES)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
.c.o: $(INCLUDES)
$(CC) $(CFLAGS) -c $<
clean:
rm -rf $(TARGETS)
rm -rf $(TARGETS:=.o)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment