From b228349c5d3e93e8e58e96efeb332fdb58093f0f Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 18 Mar 2020 18:18:15 +0100 Subject: Initial commit --- Makefile | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2a6469e --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +RM = rm -f +MKDIR = mkdir -p + +NAME = 2048 + +SRCDIR = src +INCDIR = include +OBJDIR = build + +CXX = g++ +CXXFLAGS = -Wall -Wextra -I$(INCDIR) $(shell sdl2-config --cflags) +LDFLAGS = $(shell sdl2-config --libs) + +SRC = $(shell find $(SRCDIR) -type f -name "*.cpp") +INC = $(shell find $(INCDIR) -type f -name "*.h" -name "*.hpp") +OBJ = $(SRC:$(SRCDIR)/%.cpp=$(OBJDIR)/%.o) + +all: prebuild $(NAME) + +prebuild: + $(MKDIR) $(OBJDIR) + +$(NAME): $(OBJ) + $(CXX) -o $@ $^ $(LDFLAGS) + +$(OBJDIR)/%.o: $(SRCDIR)/%.cpp + $(CXX) $(CXXFLAGS) -c -o $@ $< + +clean: + $(RM) $(OBJ) + +fclean: clean + $(RM) $(NAME) + +re: fclean all -- cgit