From 7fd3354f2d94d1aaa6de0cfea084ede66340f94d Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Sun, 13 Nov 2022 18:02:53 +0100 Subject: add Makefile --- Makefile | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..47549f6 --- /dev/null +++ b/Makefile @@ -0,0 +1,34 @@ +CC = g++ +CFLAGS = -Wall -g + +TARGET = civ + +SRCDIR = src + +LIBS = -lsfml-audio -lsfml-graphics -lsfml-system -lsfml-window -lsfml-network + +OBJDIR = build +BASENM = $(notdir $(basename $(wildcard src/*.cpp))) +OBJS = $(addsuffix .o, $(addprefix $(OBJDIR)/, $(BASENM)) ) + +GRAPHICS_BASENM = $(notdir $(basename $(wildcard src/graphics/*.cpp))) +GRAPHICS_OBJS = $(addsuffix .o, $(addprefix $(OBJDIR)/graphics/, $(GRAPHICS_BASENM)) ) + +all: $(TARGET) + +$(TARGET): $(OBJS) $(GRAPHICS_OBJS) + echo $(GRAPHICS_OBJS) + $(CC) $(OBJS) $(GRAPHICS_OBJS) -o $(TARGET) $(LIBS) + +$(OBJS): $(OBJDIR)/%.o: $(SRCDIR)/%.cpp + mkdir -p $(OBJDIR) + $(CC) $(CFLAGS) -o $@ -c $< + +$(GRAPHICS_OBJS): $(OBJDIR)/graphics/%.o: $(SRCDIR)/graphics/%.cpp + mkdir -p $(OBJDIR)/graphics/ + $(CC) $(CFLAGS) -o $@ -c $< + +clean: + rm -r $(OBJDIR) $(TARGET) + +.PHONY: all clean -- cgit v1.2.3