Created
February 3, 2015 12:23
-
-
Save sagidayan/577da25c7e23b133623c to your computer and use it in GitHub Desktop.
Generic Makefile
This file contains 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
# Sagi Dayan - Makefile | |
# 2014-2015 | |
# compiler - for C++ change to g++ | |
CC=gcc | |
# compile arguments | |
CFLAGS+=-c -g -Wall | |
# linker flags | |
LDFLAGS+= | |
# libraries | |
LIBS+= | |
# our source files | |
SOURCES=########ADD_SOURCES####### | |
# a macro to define the objects from sources | |
OBJECTS=$(SOURCES:.c=.o) | |
# executable name | |
EXECUTABLE=########CHANGE_NAME####### | |
$(EXECUTABLE): $(OBJECTS) | |
@echo "Building target" $@ "..." | |
$(CC) $(LDFLAGS) $(OBJECTS) -o $@ $(LIBS) | |
@echo "Done!" | |
# a rule for generating object files given their c files | |
.c.o: | |
@echo "Compiling" $< "..." | |
$(CC) $(CFLAGS) $< -o $@ | |
@echo "Done!" | |
clean: | |
@echo "Ceaning up *.o Files..." | |
rm -rf *s *o $(EXECUTABLE) | |
@echo "Done!" | |
.PHONY: all clean |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment