Created
August 15, 2018 00:07
-
-
Save JakubGrobelny/8f3a61b138308b171a0dc4c204414686 to your computer and use it in GitHub Desktop.
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
COMPILER = # FILL # compiler | |
FLAGS = # FILL # compiler flags | |
LIBS = # FILL # linked libraries | |
TARGET = # FILL # name (and path) of the executable | |
# to use with .cpp change *.c to *.cpp | |
SRC = $(shell find src -name "*.c") | |
OBJ = $(patsubst src/%.c, build/%.o, $(SRC)) | |
DEP = $(OBJ:%.o=%.d) | |
$(TARGET) : $(OBJ) | |
$(RM) -rf bin | |
@mkdir -p bin | |
$(COMPILER) $(FLAGS) -o $(TARGET) $(OBJ) $(LIBS) | |
-include $(DEP) | |
build/%.o : src/%.c | |
@mkdir -p build | |
@mkdir -p $(dir $@) | |
$(COMPILER) $(FLAGS) -MMD -c $< -o $@ $(LIBS) | |
clean: | |
$(RM) -rf build bin | |
.PHONY: clean |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment