diff options
author | Ekaitz Zarraga <ekaitz@elenq.tech> | 2022-11-13 18:02:53 +0100 |
---|---|---|
committer | Ekaitz Zarraga <ekaitz@elenq.tech> | 2022-11-13 18:24:39 +0100 |
commit | 7fd3354f2d94d1aaa6de0cfea084ede66340f94d (patch) | |
tree | d1b891b75d67a61bdb63b970fc77498b7b39c9e5 /Makefile | |
parent | f0830e11b81dcbbcac0e44a24bf6d7211530ae28 (diff) |
add Makefile
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 34 |
1 files changed, 34 insertions, 0 deletions
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 |