Skip to content

Instantly share code, notes, and snippets.

@prabirshrestha
Created July 7, 2012 06:35
Show Gist options
  • Save prabirshrestha/3065113 to your computer and use it in GitHub Desktop.
Save prabirshrestha/3065113 to your computer and use it in GitHub Desktop.
Makefile with sources/objects/executable
CC=clang
CFLAGS=-c -Wall
LDFLAGS=
SOURCES=hello.c
OBJECTS=$(SOURCES:.c=.o)
EXECUTABLE=hello
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
.c.o:
$(CC) $(CFLAGS) $< -o $@
clean:
rm -rf *.o $(EXECUTABLE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment