Created
May 2, 2019 20:52
-
-
Save LinArcX/c489f8e2211c6acac9fa59eaef9e91ea to your computer and use it in GitHub Desktop.
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
TARGET = main | |
LIBS = -lm | |
CC = gcc | |
CFLAGS = -g -Wall | |
ODIR = ./build | |
SDIR = ./src | |
.PHONY: default all clean | |
default: $(ODIR)/$(TARGET) | |
all: default | |
OBJECTS = $(patsubst $(SDIR)/%.c, $(ODIR)/%.o, $(wildcard $(SDIR)/*.c)) | |
HEADERS = $(wildcard $(SDIR)/*.h) | |
$(ODIR)/%.o: $(SDIR)/%.c $(HEADERS) | |
$(CC) $(CFLAGS) -c $< -o $@ | |
.PRECIOUS: $(TARGET) $(OBJECTS) | |
$(ODIR)/$(TARGET): $(OBJECTS) | |
$(CC) $(OBJECTS) -Wall $(LIBS) -o $@ | |
clean: | |
-rm -f $(ODIR)/* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment