From fed43b1232f674bd9dec130ea1bf624b71cbe26c Mon Sep 17 00:00:00 2001 From: rtrimana Date: Fri, 30 Mar 2018 15:11:38 -0700 Subject: [PATCH] Cleaning up the Makefile for compiler related commands; cleaning up C++ stubs and skeletons further. --- .../Cpp/Lifxtest/LightBulbTest_Stub.cpp | 39 +---- benchmarks/Cpp/Lifxtest/RoomSmart_Stub.cpp | 12 -- .../drivers/Cpp/LabRoom/Room_Skeleton.cpp | 1 - .../Cpp/LifxLightBulb/LifxLightBulb.cpp | 6 +- .../Cpp/LifxLightBulb/LightBulb_Skeleton.cpp | 3 + iotjava/Makefile | 159 ++++++------------ 6 files changed, 59 insertions(+), 161 deletions(-) diff --git a/benchmarks/Cpp/Lifxtest/LightBulbTest_Stub.cpp b/benchmarks/Cpp/Lifxtest/LightBulbTest_Stub.cpp index f760f89..d811274 100644 --- a/benchmarks/Cpp/Lifxtest/LightBulbTest_Stub.cpp +++ b/benchmarks/Cpp/Lifxtest/LightBulbTest_Stub.cpp @@ -215,43 +215,6 @@ extern "C" void destroyLightBulbTest_Stub(void* t) { extern "C" void initLightBulbTest_Stub(void* t) { } -/*int main() { - return 0; -}*/ - -int main() -{ - - int send_port = 5010; - int recv_port = 5011; - //const char* skeletonAddress = "127.0.0.1"; - const char* skeletonAddress = "localhost"; - int rev = 0; - bool result = false; - - LightBulbTest_Stub *lbs = new LightBulbTest_Stub(send_port, recv_port, skeletonAddress, rev, &result); - cout << "Successfully instantiated stub!" << endl; - lbs->init(); - lbs->turnOn(); - this_thread::sleep_for (chrono::milliseconds(1000)); - lbs->turnOff(); - for (int i = 0; i < 2; i++) { - lbs->turnOff(); - cout << "Turning off!" << endl; - this_thread::sleep_for (chrono::milliseconds(1000)); - lbs->turnOn(); - cout << "Turning on!" << endl; - this_thread::sleep_for (chrono::milliseconds(1000)); - double hue = lbs->getHue(); - double saturation = lbs->getSaturation(); - cout << "Hue: " << hue << endl; - cout << "Saturation: " << saturation << endl; - this_thread::sleep_for (chrono::milliseconds(1000)); - } - //lbs->turnOff(); - cout << "Done controlling! Exit now!" << endl; - - delete lbs; - +int main() { return 0; } diff --git a/benchmarks/Cpp/Lifxtest/RoomSmart_Stub.cpp b/benchmarks/Cpp/Lifxtest/RoomSmart_Stub.cpp index bfe7f78..0e1a498 100644 --- a/benchmarks/Cpp/Lifxtest/RoomSmart_Stub.cpp +++ b/benchmarks/Cpp/Lifxtest/RoomSmart_Stub.cpp @@ -70,17 +70,5 @@ extern "C" void initRoomSmart_Stub(void* t) { } int main() { - - /*int send_port = 5010; - int recv_port = 5011; - const char* skeletonAddress = "localhost"; - //const char* skeletonAddress = "l92.168.1.198"; - //const char* skeletonAddress = "127.0.0.1"; - int rev = 0; - bool result = false; - - RoomSmart_Stub *rm = new RoomSmart_Stub(send_port, recv_port, skeletonAddress, rev, &result); - cout << "Successfully instantiated stub!" << endl;*/ - return 0; } diff --git a/benchmarks/drivers/Cpp/LabRoom/Room_Skeleton.cpp b/benchmarks/drivers/Cpp/LabRoom/Room_Skeleton.cpp index c51102f..f0575de 100644 --- a/benchmarks/drivers/Cpp/LabRoom/Room_Skeleton.cpp +++ b/benchmarks/drivers/Cpp/LabRoom/Room_Skeleton.cpp @@ -96,7 +96,6 @@ extern "C" void destroyRoom_Skeleton(void* t) { extern "C" void initRoom_Skeleton(void* t) { } - int main() { return 0; } diff --git a/benchmarks/drivers/Cpp/LifxLightBulb/LifxLightBulb.cpp b/benchmarks/drivers/Cpp/LifxLightBulb/LifxLightBulb.cpp index 667d765..7b7ce1d 100644 --- a/benchmarks/drivers/Cpp/LifxLightBulb/LifxLightBulb.cpp +++ b/benchmarks/drivers/Cpp/LifxLightBulb/LifxLightBulb.cpp @@ -33,9 +33,9 @@ extern "C" void initLifxLightBulb(void* t) { // Constructor LifxLightBulb::LifxLightBulb() { // LB1 macAddress: d0:73:d5:12:8e:30 - // LB1 macAddress: d0:73:d5:02:41:da - string macAddress = "D073D5128E300000"; // bulbMacAddress: [-48, 115, -43, 18, -114, 48, 0, 0] - //string macAddress = "D073D50241DA0000"; // bulbMacAddress: [-48, 115, -43, 2, 65, -38, 0, 0] + // LB2 macAddress: d0:73:d5:02:41:da + string macAddress = "D073D5128E300000"; + //string macAddress = "D073D50241DA0000"; /*bulbMacAddress[0] = 0xD0; bulbMacAddress[1] = 0x73; bulbMacAddress[2] = 0xD5; diff --git a/benchmarks/drivers/Cpp/LifxLightBulb/LightBulb_Skeleton.cpp b/benchmarks/drivers/Cpp/LifxLightBulb/LightBulb_Skeleton.cpp index 240c361..bd57e29 100644 --- a/benchmarks/drivers/Cpp/LifxLightBulb/LightBulb_Skeleton.cpp +++ b/benchmarks/drivers/Cpp/LifxLightBulb/LightBulb_Skeleton.cpp @@ -465,3 +465,6 @@ extern "C" void destroyLightBulb_Skeleton(void* t) { extern "C" void initLightBulb_Skeleton(void* t) { } +int main() { + return 0; +} diff --git a/iotjava/Makefile b/iotjava/Makefile index 6ca70c7..44237a7 100644 --- a/iotjava/Makefile +++ b/iotjava/Makefile @@ -39,13 +39,61 @@ run-compiler-dev: #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 #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 +# TODO: Can remove this later - just to test-compile the resulted files from the compiler +PHONY += compile +compile: + cp ./iotrmi/Java/basics/* $(BIN_DIR)/iotpolicy/output_files/Java + #cp ./iotrmi/C++/basics/* $(BIN_DIR)/iotpolicy/output_files/Cplus + #cd $(BIN_DIR)/iotpolicy/output_files; cp *.java ./Java + #cd $(BIN_DIR)/iotpolicy/output_files; cp *.hpp ./Cplus + +# Cleaning the compiler output +PHONY += output-clean +output-clean: + rm -rf $(BIN_DIR)/iotpolicy/output_files + rm -rf $(BIN_DIR)/iotpolicy/*.req + rm -rf $(BIN_DIR)/iotpolicy/*.pol + +# RMI compilation (for Java) +# Note: For C++, the RMI will be in the binary file of the generated .so file of the stub and skeleton +PHONY += rmi +rmi: + $(JAVAC) -cp .:../$(BIN_DIR) -d $(BIN_DIR) iotrmi/Java/*.java + +PHONY += installer +installer: + $(JAVAC) -d $(BIN_DIR) iotinstaller/*.java + cp ../localconfig/iotruntime/MySQLInterface.config $(BIN_DIR)/iotruntime/ + cp ../localconfig/iotruntime/MySQLInterface.config $(BIN_DIR)/iotinstaller/ +PHONY += runtime +runtime: + $(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) + cp ../localconfig/iotruntime/IoTMaster.config $(BIN_DIR)/iotruntime/ + cp ../localconfig/iotruntime/IoTSlave.config $(BIN_DIR)/iotruntime/ + cp ../localconfig/iotruntime/*.bash $(BIN_DIR)/iotruntime/ + cp -r ../localconfig/mysql $(BIN_DIR)/iotruntime/ + cp -r ../localconfig/tomoyo $(BIN_DIR)/iotruntime/ + [ -d $(BIN_DIR)/iotruntime/log ] || mkdir $(BIN_DIR)/iotruntime/log + +PHONY += doc +doc: runtime installer rmi compiler + $(JAVADOC) -d $(DOCS_DIR) iotinstaller/*.java iotruntime/*.java iotrmi/*.java iotcompiler/*.java + + +# ==================================================================== # +# # +# The followings are the variety of make commands for Vigilia compiler # +# # +# ==================================================================== # + +# Lifxtest PHONY += run-compiler-lbtest run-compiler-lbtest: cp ../localconfig/iotpolicy/LifxLightBulb/*.pol $(BIN_DIR)/iotpolicy/ cp ../localconfig/iotpolicy/LifxLightBulb/*.req $(BIN_DIR)/iotpolicy/ - #cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler lifxlightbulb.pol lifxtest.req -java Java - cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler lifxlightbulb.pol lifxtest.req -cplus Cplus + cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler lifxlightbulb.pol lifxtest.req -java Java + #cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler lifxlightbulb.pol lifxtest.req -cplus Cplus # SmartLightsController PHONY += run-compiler-smartlight @@ -65,8 +113,8 @@ PHONY += run-compiler-room run-compiler-room: cp ../localconfig/iotpolicy/Room/*.pol $(BIN_DIR)/iotpolicy/ cp ../localconfig/iotpolicy/Room/*.req $(BIN_DIR)/iotpolicy/ - cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler room.pol roomsmart.req -java Java - #cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler room.pol roomsmart.req -cplus C++ + #cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler room.pol roomsmart.req -java Java + cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler room.pol roomsmart.req -cplus C++ PHONY += run-compiler-cam run-compiler-cam: @@ -149,107 +197,4 @@ run-compiler-actuate: cp ../localconfig/iotpolicy/SmartthingsActuator/*.req $(BIN_DIR)/iotpolicy/ cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler smartthingsactuator.pol smartthingsactuator.req smartthingsactuatorcallback.pol smartthingsactuatorcallback.req -java Java -# TODO: Can remove this later - just to test-compile the resulted files from the compiler -PHONY += compile -compile: - cp ./iotrmi/Java/basics/* $(BIN_DIR)/iotpolicy/output_files/Java - #cp ./iotrmi/C++/basics/* $(BIN_DIR)/iotpolicy/output_files/Cplus - cd $(BIN_DIR)/iotpolicy/output_files; cp *.java ./Java - cd $(BIN_DIR)/iotpolicy/output_files; cp *.hpp ./Cplus -# cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClass_ProfilingStub.java -# cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClass_Skeleton.java - #cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClassAdvanced_Stub.java - #cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClassCallbacks_Stub.java -# cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClassInterface_Skeleton.java -Xlint:unchecked -# cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClassComplete_Stub.java -Xlint:unchecked -# cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) CallBackInterfaceWithCallBack_Stub.java -Xlint:unchecked -# cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) CallBackInterface_Skeleton.java -Xlint:unchecked -# cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) CallBackInterface_CallbackSkeleton.java -# cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) CallBackInterfaceWithCallBack_CallbackStub.java - - cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClassInterface_Skeleton.cpp -o ./TestClassInterface_Skeleton.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/ - cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClassComplete_Stub.cpp -o ./TestClassComplete_Stub.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/ - #cp ./iotrmi/C++/ConcurrentLinkedListQueue.cpp $(BIN_DIR)/iotpolicy/output_files/Cplus - #cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./ConcurrentLinkedListQueue.cpp -o ./ConcurrentLinkedListQueue.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/ - - #cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClassAdvanced_Stub.cpp -o ./TestClassAdvanced_Stub.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/ - #cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClass.hpp -o ./TestClass.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/ - #cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClassInterface_Skeleton.cpp -o ./TestClassInterface_Skeleton.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/ - #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++/ - #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++/ - #cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(ARM_G++) ./TestClassComplete_Stub.hpp --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/ - #cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(ARM_G++) ./TestClassInterface_Skeleton.hpp --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/ - -PHONY += run-java-skeleton -run-java-skeleton: - cd ../bin/iotpolicy/output_files/Java; $(JAVA) -cp .:../../../$(BIN_DIR) TestClass_Skeleton - -PHONY += run-java-stub -run-java-stub: - cd ../bin/iotpolicy/output_files/Java; $(JAVA) -cp .:../../../$(BIN_DIR) TestClass_ProfilingStub -# cd ../bin/iotpolicy/output_files/Java; $(JAVA) -cp .:../../../$(BIN_DIR) TestClass_Stub -# cd ../bin/iotpolicy/output_files/Java; $(JAVA) -cp .:../../../$(BIN_DIR) TestClassAdvanced_Stub -# cd ../bin/iotpolicy/output_files/Java; $(JAVA) -cp .:../../../$(BIN_DIR) TestClassCallbacks_Stub - -PHONY += run-cplus-skeleton -run-cplus-skeleton: -# ../bin/iotpolicy/output_files/Cplus/TestClass_Skeleton.out - ../bin/iotpolicy/output_files/Cplus/TestClassInterface_Skeleton.out - -PHONY += run-cplus-stub -run-cplus-stub: -# ../bin/iotpolicy/output_files/Cplus/TestClass_Stub.out -# ../bin/iotpolicy/output_files/Cplus/TestClassAdvanced_Stub.out -# ../bin/iotpolicy/output_files/Cplus/TestClassCallbacks_Stub.out - ../bin/iotpolicy/output_files/Cplus/TestClassComplete_Stub.out - -PHONY += folderclean -folderclean: - rm -rf $(BIN_DIR)/iotpolicy/output_files - -PHONY += clean -clean: - cd $(BIN_DIR)/iotpolicy/output_files; rm -rf *.class *.gch - cd $(BIN_DIR)/iotpolicy/output_files/Java; rm -rf *.class - cd $(BIN_DIR)/iotpolicy/output_files/Cplus; rm -rf *.gch - cd $(BIN_DIR)/iotpolicy/output_files/Cplus; rm -rf *.out - -# RMI compilation and run -PHONY += rmi -rmi: - mkdir -p $(BIN_DIR) - $(JAVAC) -cp .:../$(BIN_DIR) -d $(BIN_DIR) iotrmi/Java/*.java - #$(JAVAC) -cp .:../$(BIN_DIR) -d $(BIN_DIR) iotrmi/Java/sample/*.java - #mkdir -p $(BIN_DIR)/iotrmi/C++/sample - #$(G++) iotrmi/C++/sample/TestClass_Stub.cpp -o $(BIN_DIR)/iotrmi/C++/sample/TestClass_Stub.out --std=c++11 -pthread -pg - #$(G++) iotrmi/C++/sample/TestClass_Skeleton.cpp -o $(BIN_DIR)/iotrmi/C++/sample/TestClass_Skeleton.out --std=c++11 -pthread -pg - -PHONY += run-rmiserver -run-rmiserver: - $(JAVA) -cp .:$(BIN_DIR) iotrmi.Java.sample.TestClass_Skeleton - -PHONY += run-rmiclient -run-rmiclient: - $(JAVA) -cp .:$(BIN_DIR) iotrmi.Java.sample.TestClass_Stub - -PHONY += installer -installer: - $(JAVAC) -d $(BIN_DIR) iotinstaller/*.java - cp ../localconfig/iotruntime/MySQLInterface.config $(BIN_DIR)/iotruntime/ - cp ../localconfig/iotruntime/MySQLInterface.config $(BIN_DIR)/iotinstaller/ - -PHONY += runtime -runtime: - $(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) - cp ../localconfig/iotruntime/IoTMaster.config $(BIN_DIR)/iotruntime/ - cp ../localconfig/iotruntime/IoTSlave.config $(BIN_DIR)/iotruntime/ - cp ../localconfig/iotruntime/*.bash $(BIN_DIR)/iotruntime/ - cp -r ../localconfig/mysql $(BIN_DIR)/iotruntime/ - cp -r ../localconfig/tomoyo $(BIN_DIR)/iotruntime/ - [ -d $(BIN_DIR)/iotruntime/log ] || mkdir $(BIN_DIR)/iotruntime/log - -PHONY += doc -doc: runtime installer rmi compiler - $(JAVADOC) -d $(DOCS_DIR) iotinstaller/*.java iotruntime/*.java iotrmi/*.java iotcompiler/*.java - .PHONY: $(PHONY) -- 2.34.1