-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile
64 lines (40 loc) · 1.68 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
CXX=x86_64-w64-mingw32-g++.exe
CXXFLAGS= -c -v -Wall -mwindows
MC_API_targetdir=bin
MC_API_sampledir=samples
#interprocess directories
IP_dir=InterProcess
IP_targetdir=$(IP_dir)/bin
all: $(MC_API_targetdir)/mc_api.dll samples interprocess
interprocess: $(IP_targetdir)/interprocess.o
samples: $(MC_API_targetdir)/mc_client.exe $(MC_API_targetdir)/mc_host.exe
#Make the wrapper API
mc_api_dll.o: mc_api_dll.c mc_api_dll.h
$(CXX) $(CXXFLAGS) -DBUILDING_MC_API_DLL mc_api_dll.c
#Make the actual DLL
$(MC_API_targetdir)/mc_api.dll: mc_api_dll.o $(IP_targetdir)/interprocess.o
$(CXX) -shared -o $(MC_API_targetdir)/mc_api.dll mc_api_dll.o $(IP_targetdir)/interprocess.o -Wl,--out-implib,mc_api.a $(LinkerWinAPILibObj)
#Make the underlying interprocess routine
$(IP_targetdir)/interprocess.o:
cd $(IP_dir) && make clean && make all && cd ..
#Make the samples: host
$(MC_API_targetdir)/mc_host.exe: $(MC_API_targetdir)/mc_api.dll mc_host.o
$(CXX) -o $(MC_API_targetdir)/mc_host.exe mc_host.o -L$(MC_API_targetdir) -lmc_api $(LinkerWinAPILibObj)
mc_host.o: $(MC_API_sampledir)/mc_host.c
$(CXX) $(CXXFLAGS) $(MC_API_sampledir)/mc_host.c
#Make the samples: client
$(MC_API_targetdir)/mc_client.exe: mc_client.o
$(CXX) -o $(MC_API_targetdir)/mc_client.exe mc_client.o -L$(MC_API_targetdir) -lmc_api $(LinkerWinAPILibObj)
mc_client.o: $(MC_API_sampledir)/mc_client.c
$(CXX) $(CXXFLAGS) $(MC_API_sampledir)/mc_client.c
.PHONY: run
run:
start $(MC_API_targetdir)/mc_host.exe
$(MC_API_targetdir)/mc_client.exe
# start $(IP_targetdir)/host.exe
# $(IP_targetdir)/client.exe
.PHONY: clean
clean:
rm -rfv *.o *.dll *.a
rm -rfv bin/*.dll bin/*.exe
rm -fv $(IP_targetdir)/interprocess.o