Skip to content

Instantly share code, notes, and snippets.

@atomictom
Created April 22, 2014 00:55
Show Gist options
  • Save atomictom/11161796 to your computer and use it in GitHub Desktop.
Save atomictom/11161796 to your computer and use it in GitHub Desktop.
CC=gcc
CFLAGS=-Wall -O3 -g
LDFLAGS=-pthread
COMPILEONLY=-c
SOURCES=queue.c
OBJECTS=$(SOURCES:.c=.o)
EXECUTABLE=$(firstword $(SOURCES:.c=))
.PHONY: clean run
.SUFFIXES:
.SUFFIXES: .c .o
all: $(SOURCES) $(EXECUTABLE)
clean:
rm -f $(OBJECTS) $(EXECUTABLE)
build: clean all
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
%.o: %.c
$(CC) $(CFLAGS) $(COMPILEONLY) $< -o $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment