Last active
September 29, 2015 03:58
-
-
Save c4pt0r/1543525 to your computer and use it in GitHub Desktop.
my makefile template 2
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
CC = gcc | |
CFLAGS = -c -Wall -g -Os | |
LD = $(CC) | |
LDFLAGS = -lfoo | |
TARGET = MyProject | |
OBJECTS = $(patsubst %.c, %.o, $(wildcard *.c)) | |
all: $(TARGET) | |
$(TARGET): $(OBJECTS) | |
$(LD) -o $@ $^ $(LDFLAGS) | |
# You don't even need to be explicit here, | |
# compiling C files is handled automagically by Make. | |
%.o: %.c | |
$(CC) $(CFLAGS) $^ -o $@ | |
clean: | |
rm $(TARGET) $(OBJECTS) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment