44237a78d51782db818233597c5e16155adc6569
[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 # TODO: Can remove this later - just to test-compile the resulted files from the compiler
43 PHONY += compile
44 compile:
45         cp ./iotrmi/Java/basics/* $(BIN_DIR)/iotpolicy/output_files/Java
46         #cp ./iotrmi/C++/basics/* $(BIN_DIR)/iotpolicy/output_files/Cplus
47         #cd $(BIN_DIR)/iotpolicy/output_files; cp *.java ./Java
48         #cd $(BIN_DIR)/iotpolicy/output_files; cp *.hpp ./Cplus
49
50 # Cleaning the compiler output
51 PHONY += output-clean
52 output-clean:
53         rm -rf $(BIN_DIR)/iotpolicy/output_files
54         rm -rf $(BIN_DIR)/iotpolicy/*.req
55         rm -rf $(BIN_DIR)/iotpolicy/*.pol
56
57 # RMI compilation (for Java)
58 # Note: For C++, the RMI will be in the binary file of the generated .so file of the stub and skeleton
59 PHONY += rmi
60 rmi:
61         $(JAVAC) -cp .:../$(BIN_DIR) -d $(BIN_DIR) iotrmi/Java/*.java
62
63 PHONY += installer
64 installer:
65         $(JAVAC)  -d $(BIN_DIR) iotinstaller/*.java
66         cp ../localconfig/iotruntime/MySQLInterface.config $(BIN_DIR)/iotruntime/
67         cp ../localconfig/iotruntime/MySQLInterface.config $(BIN_DIR)/iotinstaller/
68
69 PHONY += runtime
70 runtime:
71         $(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)
72         cp ../localconfig/iotruntime/IoTMaster.config $(BIN_DIR)/iotruntime/
73         cp ../localconfig/iotruntime/IoTSlave.config $(BIN_DIR)/iotruntime/
74         cp ../localconfig/iotruntime/*.bash $(BIN_DIR)/iotruntime/
75         cp -r ../localconfig/mysql $(BIN_DIR)/iotruntime/
76         cp -r ../localconfig/tomoyo $(BIN_DIR)/iotruntime/
77         [ -d $(BIN_DIR)/iotruntime/log ] || mkdir $(BIN_DIR)/iotruntime/log
78
79 PHONY += doc
80 doc: runtime installer rmi compiler
81         $(JAVADOC) -d $(DOCS_DIR) iotinstaller/*.java iotruntime/*.java iotrmi/*.java iotcompiler/*.java
82
83
84 # ==================================================================== #
85 #                                                                      #
86 # The followings are the variety of make commands for Vigilia compiler #
87 #                                                                      #
88 # ==================================================================== #
89
90 # Lifxtest
91 PHONY += run-compiler-lbtest
92 run-compiler-lbtest:
93         cp ../localconfig/iotpolicy/LifxLightBulb/*.pol $(BIN_DIR)/iotpolicy/
94         cp ../localconfig/iotpolicy/LifxLightBulb/*.req $(BIN_DIR)/iotpolicy/
95         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler lifxlightbulb.pol lifxtest.req -java Java
96         #cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler lifxlightbulb.pol lifxtest.req -cplus Cplus
97
98 # SmartLightsController
99 PHONY += run-compiler-smartlight
100 run-compiler-smartlight:
101         cp ../localconfig/iotpolicy/LifxLightBulb/*.pol $(BIN_DIR)/iotpolicy/
102         cp ../localconfig/iotpolicy/LifxLightBulb/*.req $(BIN_DIR)/iotpolicy/
103         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
104
105 PHONY += run-compiler-lifx
106 run-compiler-lifx:
107         cp ../localconfig/iotpolicy/LifxLightBulb/*.pol $(BIN_DIR)/iotpolicy/
108         cp ../localconfig/iotpolicy/LifxLightBulb/*.req $(BIN_DIR)/iotpolicy/
109         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler lifxlightbulb.pol smartlightsbulb.req -java Java
110         #cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler lifxlightbulb.pol smartlightsbulb.req -cplus C++
111
112 PHONY += run-compiler-room
113 run-compiler-room:
114         cp ../localconfig/iotpolicy/Room/*.pol $(BIN_DIR)/iotpolicy/
115         cp ../localconfig/iotpolicy/Room/*.req $(BIN_DIR)/iotpolicy/
116         #cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler room.pol roomsmart.req -java Java
117         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler room.pol roomsmart.req -cplus C++
118
119 PHONY += run-compiler-cam
120 run-compiler-cam:
121         cp ../localconfig/iotpolicy/AmcrestCamera/*.pol $(BIN_DIR)/iotpolicy/
122         cp ../localconfig/iotpolicy/AmcrestCamera/*.req $(BIN_DIR)/iotpolicy/
123         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler amcrestcamera.pol smartlightscam.req motiondetection.pol motiondetection.req -java Java
124
125 # IrrigationController
126 PHONY += run-compiler-irrigation
127 run-compiler-irrigation:
128         cp ../localconfig/iotpolicy/LifxLightBulb/*.pol $(BIN_DIR)/iotpolicy/
129         cp ../localconfig/iotpolicy/LifxLightBulb/*.req $(BIN_DIR)/iotpolicy/
130         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
131
132 PHONY += run-compiler-lawn
133 run-compiler-lawn:
134         cp ../localconfig/iotpolicy/GreenLawn/*.pol $(BIN_DIR)/iotpolicy/
135         cp ../localconfig/iotpolicy/GreenLawn/*.req $(BIN_DIR)/iotpolicy/
136         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler greenlawn.pol smartlawn.req -java Java
137
138 PHONY += run-compiler-sprk
139 run-compiler-sprk:
140         cp ../localconfig/iotpolicy/EspSprinkler/*.pol $(BIN_DIR)/iotpolicy/
141         cp ../localconfig/iotpolicy/EspSprinkler/*.req $(BIN_DIR)/iotpolicy/
142         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler espsprinkler.pol smartsprinkler.req -java Java
143
144 PHONY += run-compiler-wgw
145 run-compiler-wgw:
146         cp ../localconfig/iotpolicy/WeatherPhoneGateway/*.pol $(BIN_DIR)/iotpolicy/
147         cp ../localconfig/iotpolicy/WeatherPhoneGateway/*.req $(BIN_DIR)/iotpolicy/
148         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler weatherphonegateway.pol smartweathergateway.req weathergatewaycallback.pol smartweathergatewaycallback.req -java Java
149
150 PHONY += run-compiler-moist
151 run-compiler-moist:
152         cp ../localconfig/iotpolicy/SpruceSensor/*.pol $(BIN_DIR)/iotpolicy/
153         cp ../localconfig/iotpolicy/SpruceSensor/*.req $(BIN_DIR)/iotpolicy/
154         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler sprucesensor.pol smartsensor.req moisturesensorcallback.pol moisturesensorcallback.req -java Java
155
156 # SpeakerController
157 PHONY += run-compiler-speaker
158 run-compiler-speaker:
159         cp ../localconfig/iotpolicy/LifxLightBulb/*.pol $(BIN_DIR)/iotpolicy/
160         cp ../localconfig/iotpolicy/LifxLightBulb/*.req $(BIN_DIR)/iotpolicy/
161         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
162
163 PHONY += run-compiler-spkr
164 run-compiler-spkr:
165         cp ../localconfig/iotpolicy/IHome/*.pol $(BIN_DIR)/iotpolicy/
166         cp ../localconfig/iotpolicy/IHome/*.req $(BIN_DIR)/iotpolicy/
167         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler ihome.pol smartspeaker.req speakercallback.pol smartspeakercallback.req -java Java
168
169 PHONY += run-compiler-ggw
170 run-compiler-ggw:
171         cp ../localconfig/iotpolicy/GPSPhoneGateway/*.pol $(BIN_DIR)/iotpolicy/
172         cp ../localconfig/iotpolicy/GPSPhoneGateway/*.req $(BIN_DIR)/iotpolicy/
173         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler gpsphonegateway.pol smartgpsgateway.req gpsgatewaycallback.pol smartgpsgatewaycallback.req -java Java
174
175 # HomeSecurityController
176 PHONY += run-compiler-homesec
177 run-compiler-homesec:
178         cp ../localconfig/iotpolicy/LifxLightBulb/*.pol $(BIN_DIR)/iotpolicy/
179         cp ../localconfig/iotpolicy/LifxLightBulb/*.req $(BIN_DIR)/iotpolicy/
180         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
181
182 PHONY += run-compiler-alarm
183 run-compiler-alarm:
184         cp ../localconfig/iotpolicy/EspAlarm/*.pol $(BIN_DIR)/iotpolicy/
185         cp ../localconfig/iotpolicy/EspAlarm/*.req $(BIN_DIR)/iotpolicy/
186         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler espalarm.pol smartalarm.req -java Java
187
188 PHONY += run-compiler-smart
189 run-compiler-smart:
190         cp ../localconfig/iotpolicy/SmartthingsSensor/*.pol $(BIN_DIR)/iotpolicy/
191         cp ../localconfig/iotpolicy/SmartthingsSensor/*.req $(BIN_DIR)/iotpolicy/
192         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler smartthingssensor.pol smartthingssensor.req smartthingssensorcallback.pol smartthingssensorcallback.req -java Java
193
194 PHONY += run-compiler-actuate
195 run-compiler-actuate:
196         cp ../localconfig/iotpolicy/SmartthingsActuator/*.pol $(BIN_DIR)/iotpolicy/
197         cp ../localconfig/iotpolicy/SmartthingsActuator/*.req $(BIN_DIR)/iotpolicy/
198         cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler smartthingsactuator.pol smartthingsactuator.req smartthingsactuatorcallback.pol smartthingsactuatorcallback.req -java Java
199
200 .PHONY: $(PHONY)