Cleaning up C++ slave.
[iot2.git] / iotjava / Makefile
1
2 BASE := ..
3
4 include $(BASE)/common.mk
5
6 all: mkdir tree parser compiler rmi runtime runtime-cpp installer
7
8 infra: runtime installer
9
10 PHONY += mkdir
11 mkdir:
12         [ -d ../bin ] || mkdir ../bin
13
14 # C++ slave
15 PHONY += runtime-cpp
16 runtime-cpp:
17         cd iotruntime/cpp/iotslave; make cpp
18
19 # Parser compilation and run
20 PHONY += tree
21 tree:
22         $(JAVAC) -cp .:$(PARSERJARS) -d $(BIN_DIR) iotpolicy/tree/*.java
23
24 PHONY += parser
25 parser:
26         $(JAVAC) -cp .:$(PARSERJARS) -d $(BIN_DIR) iotpolicy/parser/*.java
27
28 PHONY += compiler
29 compiler:
30         $(JAVAC) -cp .:$(PARSERJARS) -d $(BIN_DIR) iotpolicy/*.java
31
32 PHONY += run-compiler-dev
33 run-compiler-dev:
34         cp ../localconfig/iotpolicy/development/*.pol $(BIN_DIR)/iotpolicy/
35         #cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler testclasspolicy_profiling.pol testclassrequires_profiling.pol -cplus Cplus -java Java
36         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler testclasspolicy.pol testclassrequires.pol callbackpolicy.pol callbackrequires.pol -cplus Cplus -java Java
37         #cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler callbackpolicy.pol callbackrequires.pol testclasspolicy_advanced.pol testclassrequires_advanced.pol -cplus Cplus -java Java
38         #cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler callbackpolicy.pol callbackrequires.pol testclasspolicy_callbacks.pol testclassrequires_callbacks.pol -cplus Cplus -java Java
39         #cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler testclasspolicy_callbacks.pol testclassrequires_callbacks.pol callbackpolicy.pol callbackrequires.pol -cplus Cplus -java Java
40         #cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler testclasspolicy_callbacks_three.pol testclassrequires_callbacks_three.pol callbackpolicy.pol callbackrequires.pol callbackpolicy_two.pol callbackrequires_two.pol -cplus Cplus -java Java
41
42
43 PHONY += run-compiler-lbtest
44 run-compiler-lbtest:
45         cp ../localconfig/iotpolicy/LifxLightBulb/*.pol $(BIN_DIR)/iotpolicy/
46         cp ../localconfig/iotpolicy/LifxLightBulb/*.req $(BIN_DIR)/iotpolicy/
47         #cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler lifxlightbulb.pol lifxtest.req -java Java
48         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler lifxlightbulb.pol lifxtest.req -cplus Cplus
49
50 # SmartLightsController
51 PHONY += run-compiler-smartlight
52 run-compiler-smartlight:
53         cp ../localconfig/iotpolicy/LifxLightBulb/*.pol $(BIN_DIR)/iotpolicy/
54         cp ../localconfig/iotpolicy/LifxLightBulb/*.req $(BIN_DIR)/iotpolicy/
55         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler lifxlightbulb.pol smartlightsbulb.req amcrestcamera.pol smartlightscam.req motiondetection.pol motiondetection.req room.pol roomsmart.req -java Java
56
57 PHONY += run-compiler-lifx
58 run-compiler-lifx:
59         cp ../localconfig/iotpolicy/LifxLightBulb/*.pol $(BIN_DIR)/iotpolicy/
60         cp ../localconfig/iotpolicy/LifxLightBulb/*.req $(BIN_DIR)/iotpolicy/
61         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler lifxlightbulb.pol smartlightsbulb.req -java Java
62         #cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler lifxlightbulb.pol smartlightsbulb.req -cplus C++
63
64 PHONY += run-compiler-room
65 run-compiler-room:
66         cp ../localconfig/iotpolicy/Room/*.pol $(BIN_DIR)/iotpolicy/
67         cp ../localconfig/iotpolicy/Room/*.req $(BIN_DIR)/iotpolicy/
68         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler room.pol roomsmart.req -java Java
69         #cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler room.pol roomsmart.req -cplus C++
70
71 PHONY += run-compiler-cam
72 run-compiler-cam:
73         cp ../localconfig/iotpolicy/AmcrestCamera/*.pol $(BIN_DIR)/iotpolicy/
74         cp ../localconfig/iotpolicy/AmcrestCamera/*.req $(BIN_DIR)/iotpolicy/
75         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler amcrestcamera.pol smartlightscam.req motiondetection.pol motiondetection.req -java Java
76
77 # IrrigationController
78 PHONY += run-compiler-irrigation
79 run-compiler-irrigation:
80         cp ../localconfig/iotpolicy/LifxLightBulb/*.pol $(BIN_DIR)/iotpolicy/
81         cp ../localconfig/iotpolicy/LifxLightBulb/*.req $(BIN_DIR)/iotpolicy/
82         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler greenlawn.pol smartlawn.req espsprinkler.pol smartsprinkler.req  weatherphonegateway.pol smartweathergateway.req weathergatewaycallback.pol smartweathergatewaycallback.req sprucesensor.pol smartsensor.req moisturesensorcallback.pol moisturesensorcallback.req -java Java
83
84 PHONY += run-compiler-lawn
85 run-compiler-lawn:
86         cp ../localconfig/iotpolicy/GreenLawn/*.pol $(BIN_DIR)/iotpolicy/
87         cp ../localconfig/iotpolicy/GreenLawn/*.req $(BIN_DIR)/iotpolicy/
88         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler greenlawn.pol smartlawn.req -java Java
89
90 PHONY += run-compiler-sprk
91 run-compiler-sprk:
92         cp ../localconfig/iotpolicy/EspSprinkler/*.pol $(BIN_DIR)/iotpolicy/
93         cp ../localconfig/iotpolicy/EspSprinkler/*.req $(BIN_DIR)/iotpolicy/
94         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler espsprinkler.pol smartsprinkler.req -java Java
95
96 PHONY += run-compiler-wgw
97 run-compiler-wgw:
98         cp ../localconfig/iotpolicy/WeatherPhoneGateway/*.pol $(BIN_DIR)/iotpolicy/
99         cp ../localconfig/iotpolicy/WeatherPhoneGateway/*.req $(BIN_DIR)/iotpolicy/
100         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler weatherphonegateway.pol smartweathergateway.req weathergatewaycallback.pol smartweathergatewaycallback.req -java Java
101
102 PHONY += run-compiler-moist
103 run-compiler-moist:
104         cp ../localconfig/iotpolicy/SpruceSensor/*.pol $(BIN_DIR)/iotpolicy/
105         cp ../localconfig/iotpolicy/SpruceSensor/*.req $(BIN_DIR)/iotpolicy/
106         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler sprucesensor.pol smartsensor.req moisturesensorcallback.pol moisturesensorcallback.req -java Java
107
108 # SpeakerController
109 PHONY += run-compiler-speaker
110 run-compiler-speaker:
111         cp ../localconfig/iotpolicy/LifxLightBulb/*.pol $(BIN_DIR)/iotpolicy/
112         cp ../localconfig/iotpolicy/LifxLightBulb/*.req $(BIN_DIR)/iotpolicy/
113         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler ihome.pol smartspeaker.req speakercallback.pol smartspeakercallback.req gpsphonegateway.pol smartgpsgateway.req gpsgatewaycallback.pol smartgpsgatewaycallback.req -java Java
114
115 PHONY += run-compiler-spkr
116 run-compiler-spkr:
117         cp ../localconfig/iotpolicy/IHome/*.pol $(BIN_DIR)/iotpolicy/
118         cp ../localconfig/iotpolicy/IHome/*.req $(BIN_DIR)/iotpolicy/
119         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler ihome.pol smartspeaker.req speakercallback.pol smartspeakercallback.req -java Java
120
121 PHONY += run-compiler-ggw
122 run-compiler-ggw:
123         cp ../localconfig/iotpolicy/GPSPhoneGateway/*.pol $(BIN_DIR)/iotpolicy/
124         cp ../localconfig/iotpolicy/GPSPhoneGateway/*.req $(BIN_DIR)/iotpolicy/
125         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler gpsphonegateway.pol smartgpsgateway.req gpsgatewaycallback.pol smartgpsgatewaycallback.req -java Java
126
127 # HomeSecurityController
128 PHONY += run-compiler-homesec
129 run-compiler-homesec:
130         cp ../localconfig/iotpolicy/LifxLightBulb/*.pol $(BIN_DIR)/iotpolicy/
131         cp ../localconfig/iotpolicy/LifxLightBulb/*.req $(BIN_DIR)/iotpolicy/
132         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler espalarm.pol smartalarm.req smartthingssensor.pol smartthingssensor.req smartthingssensorcallback.pol smartthingssensorcallback.req -java Java
133
134 PHONY += run-compiler-alarm
135 run-compiler-alarm:
136         cp ../localconfig/iotpolicy/EspAlarm/*.pol $(BIN_DIR)/iotpolicy/
137         cp ../localconfig/iotpolicy/EspAlarm/*.req $(BIN_DIR)/iotpolicy/
138         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler espalarm.pol smartalarm.req -java Java
139
140 PHONY += run-compiler-smart
141 run-compiler-smart:
142         cp ../localconfig/iotpolicy/SmartthingsSensor/*.pol $(BIN_DIR)/iotpolicy/
143         cp ../localconfig/iotpolicy/SmartthingsSensor/*.req $(BIN_DIR)/iotpolicy/
144         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler smartthingssensor.pol smartthingssensor.req smartthingssensorcallback.pol smartthingssensorcallback.req -java Java
145
146 PHONY += run-compiler-actuate
147 run-compiler-actuate:
148         cp ../localconfig/iotpolicy/SmartthingsActuator/*.pol $(BIN_DIR)/iotpolicy/
149         cp ../localconfig/iotpolicy/SmartthingsActuator/*.req $(BIN_DIR)/iotpolicy/
150         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler smartthingsactuator.pol smartthingsactuator.req smartthingsactuatorcallback.pol smartthingsactuatorcallback.req -java Java
151
152 # TODO: Can remove this later - just to test-compile the resulted files from the compiler
153 PHONY += compile
154 compile:
155         cp ./iotrmi/Java/basics/* $(BIN_DIR)/iotpolicy/output_files/Java
156         #cp ./iotrmi/C++/basics/* $(BIN_DIR)/iotpolicy/output_files/Cplus
157         cd $(BIN_DIR)/iotpolicy/output_files; cp *.java ./Java
158         cd $(BIN_DIR)/iotpolicy/output_files; cp *.hpp ./Cplus
159 #       cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClass_ProfilingStub.java
160 #       cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClass_Skeleton.java
161         #cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClassAdvanced_Stub.java
162         #cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClassCallbacks_Stub.java
163 #       cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClassInterface_Skeleton.java -Xlint:unchecked
164 #       cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClassComplete_Stub.java -Xlint:unchecked
165 #       cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) CallBackInterfaceWithCallBack_Stub.java -Xlint:unchecked
166 #       cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) CallBackInterface_Skeleton.java -Xlint:unchecked
167 #       cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) CallBackInterface_CallbackSkeleton.java
168 #       cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) CallBackInterfaceWithCallBack_CallbackStub.java
169
170         cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClassInterface_Skeleton.cpp -o ./TestClassInterface_Skeleton.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
171         cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClassComplete_Stub.cpp -o ./TestClassComplete_Stub.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
172         #cp ./iotrmi/C++/ConcurrentLinkedListQueue.cpp $(BIN_DIR)/iotpolicy/output_files/Cplus
173         #cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./ConcurrentLinkedListQueue.cpp -o ./ConcurrentLinkedListQueue.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
174
175         #cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClassAdvanced_Stub.cpp -o ./TestClassAdvanced_Stub.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
176         #cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClass.hpp -o ./TestClass.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
177         #cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClassInterface_Skeleton.cpp -o ./TestClassInterface_Skeleton.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
178         #cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(ARM_G++) ./TestClassInterface_Skeleton.cpp -o ./TestClassInterface_Skeleton.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
179         #cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(ARM_G++) ./TestClassCallbacks_Stub.cpp -o ./TestClassCallbacks_Stub.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
180         #cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(ARM_G++) ./TestClassComplete_Stub.hpp --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
181         #cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(ARM_G++) ./TestClassInterface_Skeleton.hpp --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
182
183 PHONY += run-java-skeleton
184 run-java-skeleton:
185         cd ../bin/iotpolicy/output_files/Java; $(JAVA) -cp .:../../../$(BIN_DIR) TestClass_Skeleton
186
187 PHONY += run-java-stub
188 run-java-stub:
189         cd ../bin/iotpolicy/output_files/Java; $(JAVA) -cp .:../../../$(BIN_DIR) TestClass_ProfilingStub
190 #       cd ../bin/iotpolicy/output_files/Java; $(JAVA) -cp .:../../../$(BIN_DIR) TestClass_Stub
191 #       cd ../bin/iotpolicy/output_files/Java; $(JAVA) -cp .:../../../$(BIN_DIR) TestClassAdvanced_Stub
192 #       cd ../bin/iotpolicy/output_files/Java; $(JAVA) -cp .:../../../$(BIN_DIR) TestClassCallbacks_Stub
193
194 PHONY += run-cplus-skeleton
195 run-cplus-skeleton:
196 #       ../bin/iotpolicy/output_files/Cplus/TestClass_Skeleton.out
197         ../bin/iotpolicy/output_files/Cplus/TestClassInterface_Skeleton.out
198
199 PHONY += run-cplus-stub
200 run-cplus-stub:
201 #       ../bin/iotpolicy/output_files/Cplus/TestClass_Stub.out
202 #       ../bin/iotpolicy/output_files/Cplus/TestClassAdvanced_Stub.out
203 #       ../bin/iotpolicy/output_files/Cplus/TestClassCallbacks_Stub.out
204         ../bin/iotpolicy/output_files/Cplus/TestClassComplete_Stub.out
205
206 PHONY += folderclean
207 folderclean:
208         rm -rf $(BIN_DIR)/iotpolicy/output_files
209
210 PHONY += clean
211 clean:
212         cd $(BIN_DIR)/iotpolicy/output_files; rm -rf *.class *.gch
213         cd $(BIN_DIR)/iotpolicy/output_files/Java; rm -rf *.class
214         cd $(BIN_DIR)/iotpolicy/output_files/Cplus; rm -rf *.gch
215         cd $(BIN_DIR)/iotpolicy/output_files/Cplus; rm -rf *.out
216
217 # RMI compilation and run
218 PHONY += rmi
219 rmi:
220         mkdir -p $(BIN_DIR)
221         $(JAVAC) -cp .:../$(BIN_DIR) -d $(BIN_DIR) iotrmi/Java/*.java
222         #$(JAVAC) -cp .:../$(BIN_DIR) -d $(BIN_DIR) iotrmi/Java/sample/*.java
223         #mkdir -p $(BIN_DIR)/iotrmi/C++/sample
224         #$(G++) iotrmi/C++/sample/TestClass_Stub.cpp -o $(BIN_DIR)/iotrmi/C++/sample/TestClass_Stub.out --std=c++11 -pthread -pg
225         #$(G++) iotrmi/C++/sample/TestClass_Skeleton.cpp -o $(BIN_DIR)/iotrmi/C++/sample/TestClass_Skeleton.out --std=c++11 -pthread -pg
226
227 PHONY += run-rmiserver
228 run-rmiserver:
229         $(JAVA) -cp .:$(BIN_DIR) iotrmi.Java.sample.TestClass_Skeleton
230
231 PHONY += run-rmiclient
232 run-rmiclient:
233         $(JAVA) -cp .:$(BIN_DIR) iotrmi.Java.sample.TestClass_Stub
234
235 PHONY += installer
236 installer:
237         $(JAVAC)  -d $(BIN_DIR) iotinstaller/*.java
238         cp ../localconfig/iotruntime/MySQLInterface.config $(BIN_DIR)/iotruntime/
239         cp ../localconfig/iotruntime/MySQLInterface.config $(BIN_DIR)/iotinstaller/
240
241 PHONY += runtime
242 runtime:
243         $(JAVAC) -classpath .:$(RUNTIMEJARS):$(PHONEJARS):$(ZIPJARS) iotruntime/*.java iotruntime/master/*.java iotruntime/slave/*.java iotruntime/messages/*.java iotruntime/stub/*.java iotruntime/zigbee/*.java -d $(BIN_DIR)
244         cp ../localconfig/iotruntime/IoTMaster.config $(BIN_DIR)/iotruntime/
245         cp ../localconfig/iotruntime/IoTSlave.config $(BIN_DIR)/iotruntime/
246         cp ../localconfig/iotruntime/*.bash $(BIN_DIR)/iotruntime/
247         cp -r ../localconfig/mysql $(BIN_DIR)/iotruntime/
248         cp -r ../localconfig/tomoyo $(BIN_DIR)/iotruntime/
249         [ -d $(BIN_DIR)/iotruntime/log ] || mkdir $(BIN_DIR)/iotruntime/log
250
251 PHONY += doc
252 doc: runtime installer rmi compiler
253         $(JAVADOC) -d $(DOCS_DIR) iotinstaller/*.java iotruntime/*.java iotrmi/*.java iotcompiler/*.java
254
255 .PHONY: $(PHONY)