-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
115 lines (99 loc) · 3.1 KB
/
Makefile
File metadata and controls
115 lines (99 loc) · 3.1 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Compiler
CC:=g++
# Executable and Test files for each part of the program
# We indivisual tst files to make it easier for ourselves to debug
# It turned out to be a great decision
MEXE:=MapTest.exe
IEXE:=InventoryTest.exe
CEXE:=CartTest.exe
PEXE:=PathfinderTest.exe
EXE:=Pathfinder.exe
# Flags for the compiler
CFLAGS:=-Wall
# Objects required for each test file, first letter matches the test file
MOBJS:=Map.o
IOBJS:=Inventory.o Strings.o
COBJS:=Cart.o
POBJS:=Pathfinder.o $(MOBJS) $(COBJS) $(IOBJS)
OBJS:= $(POBJS) Main.o
# CGI Files
CGI:=Pathfinder.cgi
MGI:=Map.cgi
IGI:=Inventory.cgi
# Objects required to make the CGI files
CGIOBJS:=cgi_main.o UI.o $(POBJS)
MGIOBJS:=cgi_map.o UI.o
IGIOBJS:=cgi_inventory.o UI.o $(IOBJS)
# % acts as a wild card.
# for every .o file there is a .cpp file of the same prefix.
# This is a quick way to make a build command for every object file
%.o: %.cpp
$(CC) $(CFLAGS) -MD -MP $< -c -g -o $@
# Commands to make executable files
$(EXE): $(OBJS)
$(CC) $^ -o $@
$(MEXE): $(MOBJS)
$(CC) $^ -o $@
$(IEXE): $(IOBJS)
$(CC) $^ -o $@
$(CEXE): $(COBJS)
$(CC) $^ -o $@
$(PEXE): $(POBJS)
$(CC) $^ -o $@
# This command makes a CGI file as well as a file cgi with the .exe suffix
# This allows me to see the output of the cgi file
$(CGI): $(CGIOBJS)
$(CC) $^ -o $@
$(CC) $^ -o $@.exe
$(MGI): $(MGIOBJS)
$(CC) $^ -o $@
$(CC) $^ -o $@.exe
$(IGI): $(IGIOBJS)
$(CC) $^ -o $@
$(CC) $^ -o $@.exe
# Makes the Pathfinder folder in the CGI bin for Linux
InitCGILin:
mkdir /usr/lib/cgi-bin/Pathfinder
# Makes the Pathfinder folder in the CGI bin for Windows
InitCGIWin:
mkdir C:\xampp\cgi-bin\Pathfinder
# Makes the Web Application for Windows
WebAppWin:
# Makes the CGI files
make Pathfinder.cgi
make Map.cgi
make Inventory.cgi
# Copies the CGI files to the cgi-bin
cp Pathfinder.cgi Map.cgi Inventory.cgi icon.png C:\xampp\cgi-bin\Pathfinder
cp Map.tsv Inventory.txt C:\xampp\cgi-bin\Pathfinder
# Directs output of the %.cgi.exe files to %.html for easy debugging
./Inventory.cgi.exe > Inventory.html
./Map.cgi.exe > Map.html
./Pathfinder.cgi.exe > Path.html
# Makes the Web Application for Linux
WebAppLin:
make Pathfinder.exe
make Pathfinder.cgi
make Map.cgi
make Inventory.cgi
cp Pathfinder.cgi Map.cgi Inventory.cgi icon.png /usr/lib/cgi-bin/Pathfinder
cp Map.tsv Inventory.txt /usr/lib/cgi-bin/Pathfinder
./Inventory.cgi.exe > Inventory.html
./Map.cgi.exe > Map.html
./Pathfinder.cgi.exe > Path.html
# Makes the Web Application for Server
WebAppServer:
make Pathfinder.exe
make Pathfinder.cgi
make Map.cgi
make Inventory.cgi
cp Pathfinder.cgi Map.cgi Inventory.cgi icon.png /var/www/cgi-bin/Pathfinder
cp Map.tsv Inventory.txt /var/www/cgi-bin/Pathfinder
./Inventory.cgi.exe > Inventory.html
./Map.cgi.exe > Map.html
./Pathfinder.cgi.exe > Path.html
# Deletes all objects, dependancies, cgi, and executable files
clean:
rm -f $(OBJS) $(POBJS) $(IOBJS) $(COBJS) $(MOBJS) $(EXE) $(MEXE) $(IEXE) $(PEXE) $(CGI) $(MGI) $(IGI) $(CGI).exe $(MGI).exe $(IGI).exe $(CGIOBJS) $(MGIOBJS) $(IGIOBJS) *.d
# creates a list of dependancies so of header file is changed it recompiles
-include $(OBJS:.o=.d)