-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
78 lines (57 loc) · 1.54 KB
/
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
ifeq ($(OS),Windows_NT)
PROJECTNAME=GetHome
PROJECTEXT=.exe
LIBS=-luser32 -lgdi32 -lopengl32 -lgdiplus -lShlwapi -lstdc++fs
LFLAGS=-s -static
ODIR=obj/windows
else
PROJECTNAME=GetHome
PROJECTEXT=
LIBS=-lm -lX11 -lGL -lpthread -lpng -lstdc++fs
LFLAGS=-s -static-libstdc++
ODIR=obj/linux-x86_64
endif
IDIR=include
SDIR=src
CC=g++
CFLAGS=-I./$(IDIR) -std=c++17
_OBJ = main.o
OBJ = $(patsubst %, $(ODIR)/%,$(_OBJ))
$(ODIR)/%.o: $(SDIR)/%.cpp
$(CC) -c -o $@ $< $(CFLAGS)
bin/$(PROJECTNAME)$(PROJECTEXT): $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS) $(LFLAGS)
.PHONY: clean
clean:
ifeq ($(OS),Windows_NT)
del obj\windows\*.o
else
rm -f obj/linux-x86_64/*.o
endif
ifneq ($(OS),Windows_NT)
.PHONE: pack
pack:
rm -f assets/resource.pak
olcPack assets/resource.pak "moros rocks" add assets/*.png assets/outdoors.json
.PHONY: package-clean
package-clean:
rm -rf dist
.PHONY: package
package:
# create assets directory for linux
mkdir -p dist/linux/$(PROJECTNAME)/assets
# create assets directory for windows
mkdir -p dist/windows/$(PROJECTNAME)/assets
# copy assets to linux assets directory
cp assets/resource.pak dist/linux/$(PROJECTNAME)/assets/
# copy assets to windows assets directory
cp assets/resource.pak dist/windows/$(PROJECTNAME)/assets/
# copy linux binary
cp bin/$(PROJECTNAME) dist/linux/$(PROJECTNAME)/
# copy windows binary
cp bin/$(PROJECTNAME).exe dist/windows/$(PROJECTNAME)/
# ZIP linux
cd dist/linux; zip -r "../$(PROJECTNAME) (Linux)" .
# ZIP windows
cd dist/windows; zip -r "../$(PROJECTNAME) (Windows)" .
endif