-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
36 lines (27 loc) · 832 Bytes
/
Makefile
File metadata and controls
36 lines (27 loc) · 832 Bytes
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
35
36
.PHONY: all
GCC = g++
CFLAGS = -std=c++11 -Wall -O3
LDFLAGS = -I.
OBJDIR = obj
UNAME = $(shell uname -s)
ifeq ($(UNAME),Linux)
LDFLAGS += -lncursesw -ltinfo
endif
ifeq ($(UNAME),Darwin)
# Apple ncurses has wide char support built in
LDFLAGS += -lncurses
endif
CLASSES = entity combatstate idlestate travelstate livingentity player npc display inventory item logger util world worldlocation roadlocation wildernesslocation
OBJECTS = $(addsuffix .o, $(CLASSES))
OBJFILES = $(addprefix $(OBJDIR)/, $(OBJECTS))
all: main
main: $(OBJDIR)/main.o $(OBJFILES)
$(GCC) -o main $(CFLAGS) $(OBJDIR)/main.o $(OBJFILES) $(LDFLAGS)
$(OBJDIR)/main.o: main.cpp
$(GCC) -c $(CFLAGS) main.cpp -o $(OBJDIR)/main.o
.SECONDEXPANSION:
$(OBJFILES): %.o: $$(notdir %.cpp %.h)
$(GCC) -c $(CFLAGS) $< -o $@
clean:
rm -rf $(OBJDIR)/*.o
rm main