Skip to content

Instantly share code, notes, and snippets.

@mpeven
Last active July 7, 2016 03:35
Show Gist options
  • Save mpeven/2e06f7d71b03ab7d78c462b8f584e1a9 to your computer and use it in GitHub Desktop.
Save mpeven/2e06f7d71b03ab7d78c462b8f584e1a9 to your computer and use it in GitHub Desktop.
TARGET = prog
LIBS = -lm -lcurl -ljson-c
CC = gcc
CFLAGS = -g -Wall
.PHONY: default all clean
default: $(TARGET)
all: default
OBJECTS = $(patsubst %.c, %.o, $(wildcard *.c))
HEADERS = $(wildcard *.h)
%.o: %.c $(HEADERS) ; $(CC) $(CFLAGS) -c $< -o $@
.PRECIOUS: $(TARGET) $(OBJECTS)
$(TARGET): $(OBJECTS) ; $(CC) $(OBJECTS) -Wall $(LIBS) -o $@
clean: ; rm -f *.o ; rm -f $(TARGET)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment