Last active
December 14, 2015 13:58
-
-
Save lobatt/5097517 to your computer and use it in GitHub Desktop.
Handy Makefile for testing
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=-g -c -Wall | |
LDFLAGS= | |
CXX_SOURCES=$(wildcard *.cpp) | |
C_SOURCES=$(wildcard *.c) | |
CXX_OBJECTS=$(SOURCES:.cpp=.o) | |
C_OBJECTS=$(C_SOURCES:.c=.o) | |
OBJECTS=$(C_OBJECTS) $(CXX_OBJECTS) | |
EXECUTABLE=hello | |
all: $(SOURCES) $(EXECUTABLE) | |
$(EXECUTABLE): $(OBJECTS) | |
$(CC) $(LDFLAGS) $(OBJECTSS) -o $@ | |
.cpp.o: | |
$(CC) $(CFLAGS) $< -o $@ | |
.c.o: | |
$(CC) $(CFLAGS) $< -o $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment