Skip to content

Instantly share code, notes, and snippets.

@plopp
Forked from reecer/General Makefile
Created May 28, 2017 09:27
Show Gist options
  • Save plopp/63bfb38b066b7573076d1ff35483a58a to your computer and use it in GitHub Desktop.
Save plopp/63bfb38b066b7573076d1ff35483a58a to your computer and use it in GitHub Desktop.
A general makefile for general-purpose C projects.
CC=gcc
CCFLAGS=-Wall
LDFLAGS=
SOURCES=$(wildcard *.c)
OBJECTS=$(SOURCES:.c=.o)
TARGET=des
all: $(TARGET)
$(TARGET): $(OBJECTS)
$(CC) -o $@ $^ $(LDFLAGS)
%.o: %.c %.h
$(CC) $(CCFLAGS) -c $<
%.o: %.c
$(CC) $(CCFLAGS) -c $<
clean:
rm -f *.o $(TARGET)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment