Last active
December 14, 2015 04:59
-
-
Save Kern--/5032168 to your computer and use it in GitHub Desktop.
A simple makefile
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
#Name of the executable | |
TARGET = | |
#objects that go into the executable | |
OBJS = | |
CC = gcc | |
CFLAGS = -g -Wall | |
DEBUGGER = gdb | |
#--------------# | |
# Default rule # | |
#--------------# | |
.PHONY: default | |
default: $(OBJS) | |
$(CC) $(CFLAGS) -o $(TARGET) $(OBJS) | |
#------------# | |
# Debug rule # | |
#------------# | |
.PHONY: debug | |
debug: CFLAGS += -DDEBUG -g | |
debug: default | |
$(DEBUGGER) $(TARGET) | |
#-----------------# | |
# Make a tarball # | |
# ----------------# | |
%.tar.gz: | |
tar cfvz $@ *.c *.h Makefile | |
#-------# | |
# Clean # | |
#-------# | |
.PHONY: clean | |
clean: | |
-rm -f $(TARGET) | |
-rm -f *.o | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment