DemesneGH commented on code in PR #144:
URL: 
https://github.com/apache/incubator-teaclave-trustzone-sdk/pull/144#discussion_r1804812142


##########
examples/message_passing_interface-rs/Makefile:
##########
@@ -0,0 +1,33 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# If _HOST or _TA specific compiler/target are not specified, then use common
+# compiler/target for both
+CROSS_COMPILE_HOST ?= aarch64-linux-gnu-
+CROSS_COMPILE_TA ?= aarch64-linux-gnu-
+TARGET_HOST ?= aarch64-unknown-linux-gnu
+TARGET_TA ?= aarch64-unknown-linux-gnu
+
+all:
+       $(q)make -C host TARGET_HOST=$(TARGET_HOST) \
+               CROSS_COMPILE_HOST=$(CROSS_COMPILE_HOST)
+       $(q)make -C ta TARGET_TA=$(TARGET_TA) \
+               CROSS_COMPILE_TA=$(CROSS_COMPILE_TA)
+

Review Comment:
   > The sub-level Makefiles could rely on the variables passed down from the 
top-level Makefile and use more generic variable names, such as TARGET and 
CROSS_COMPILE, similar as the `@CROSS_COMPILE` usage for building ring.
   
   That makes sense because the `CROSS_COMPILE` is needed for building inner C 
libraries for TA. But I have some consideration for independent building.
   Keeping the `CROSS_COMPILE_{HOST, TA}` suffix helps to build CA or TA 
independently. The scenario is common, like the CA is finished and we're 
developing TA and willing to rebuild it.
   
   Currently, the `CROSS_COMPILE_{HOST, TA}` is set by `source environment` on 
env setup stage of our SDK 
(https://github.com/DemesneGH/rust-optee-trustzone-sdk/blob/a84e96d4199289844285d545ac5916fb35f1e9fb/environment)
 .
   After setup we can build only TA for one example: e.g. run `make -C 
examples/hello_world-rs/ta`. 
   
   If changed to this:
   
   > @make -C host TARGET=$(TARGET_HOST) CROSS_COMPILE=$(CROSS_COMPILE_HOST)
   > @make -C ta TARGET=$(TARGET_TA) CROSS_COMPILE=$(CROSS_COMPILE_TA)
   
   The `example/*/ta/Makefile` needs to read `CROSS_COMPILE` set by 
`example/*/Makefile`. 
   If we want to build TA only, we have to build the entire example (using 
`example/*/Makefile`) to set correct CROSS_COMPILE, or set the CROSS_COMPILE 
explicitly.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@teaclave.apache.org
For additional commands, e-mail: dev-h...@teaclave.apache.org

Reply via email to