Skip to content

Instantly share code, notes, and snippets.

@lsem
Created October 13, 2015 20:41
Show Gist options
  • Save lsem/0469f2d2f4e47d51a7d9 to your computer and use it in GitHub Desktop.
Save lsem/0469f2d2f4e47d51a7d9 to your computer and use it in GitHub Desktop.
Makefile sample
CC=g++
CFLAGS=-c -Wall
LDFLAGS=
SOURCES=main.cpp hello.cpp factorial.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=hello
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
.cpp.o:
$(CC) $(CFLAGS) $< -o $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment