Last active
December 10, 2015 21:48
-
-
Save ecerulm/4498068 to your computer and use it in GitHub Desktop.
Makefile template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CC = g++ | |
| # CFLAGS for the C compiler, CXXFLAGS for C++, and CPPFLAGS for both. | |
| CXXFLAGS= -pedantic -Wall -Wextra -Werror -ggdb3 | |
| TARGET = my-executable | |
| SOURCES = test.cpp | |
| HEADERS = test.h | |
| OBJECTS = $(SOURCES:.c=.o) | |
| all: $(TARGET) | |
| $(TARGET): $(OBJECTS) | |
| $(CC) $(CXXFLAGS) $(DEBUGFLAGS) -o $(TARGET) $(OBJECTS) | |
| %.o: %.c $(HEADERS) $(COMMON) | |
| $(CC) $(CXXFLAGS) $(DEBUGFLAGS) -c -o $@ $< | |
| profile: CXXFLAGS += -pg | |
| profile: $(TARGET) | |
| clean: | |
| -rm -f $(TARGET) | |
| -rm -f $(OBJECTS) | |
| -rm -f gmon.out | |
| .PHONY : all profile release clean |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment