summaryrefslogtreecommitdiff
path: root/Makefile
blob: 47549f63290cacc15997d319e4d7da5f6efbf209 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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