forked from richkmeli/Richkware
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
50 lines (39 loc) · 973 Bytes
/
Makefile
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Copyright 2016 Riccardo Melioli.
# executable name
TARGET = Richkware
ifeq ($(OS),Windows_NT)
CXX=g++
RM=cmd /C rmdir /Q /S
MKDIR=mkdir
else
CXX=x86_64-w64-mingw32-g++
RM=rm -rf
MKDIR=mkdir -p
endif
# flags
CXXFLAGS= -c -O3 -Wall
LDFLAGS= -static-libgcc -static-libstdc++ -static -Wall
EFLAG= -lws2_32
# directories
SRCDIR = src
OBJDIR = obj
BINDIR = bin
# files
SOURCES := $(wildcard $(SRCDIR)/*.cpp)
INCLUDES := $(wildcard $(SRCDIR)/*.h)
OBJECTS := $(SOURCES:$(SRCDIR)/%.cpp=$(OBJDIR)/%.o)
EXECUTABLE= $(BINDIR)/$(TARGET).exe
.PHONY : all
all: make_directories $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS) main.o
$(CXX) $(LDFLAGS) $(OBJECTS) $(OBJDIR)/main.o $(EFLAG) -o $@
$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.cpp
$(CXX) $(CXXFLAGS) $< -o $@
main.o:
$(CXX) $(CXXFLAGS) main.cpp -o $(OBJDIR)/main.o
.PHONY : make_directories
make_directories:
$(MKDIR) $(OBJDIR) $(BINDIR)
.PHONY : clean
clean:
$(RM) $(OBJDIR) $(BINDIR)