Junbo-Zheng opened a new pull request, #21743:
URL: https://github.com/apache/nuttx/pull/21743

   
   
   ## Summary
   
   `nuttx_generate_preprocess_target` writes its dependency file next to
   the preprocessed output (`-MF ${TARGET_FILE}.d`).  For the ROMFS
   staging targets that directory is packed verbatim by `genromfs`, so
   every CMake-built configuration with `CONFIG_ETC_ROMFS` ships the
   `.d` files in `/etc`:
   
   ```
   nsh> ls /etc/init.d
   /etc/init.d:
    init.rc
    init.rc.d        <- a make dependency rule, shipped in the image
   ```
   
   `sim:nsh` currently carries `init.rc.d` next to the real script.
   The Make flow is not affected: its `PREPROCESS` macro does not
   generate depfiles.
   
   Generate the depfile under a `.deps/` directory instead, so the
   staging directory only ever contains files meant for the image.
   The `-MT` target and the dependency semantics are unchanged.
   
   ## Impact
   
   - **Users**: CMake-built ROMFS images no longer contain stray `.d`
     files under `/etc`.
   - **Build**: depfile location only; incremental-build behavior is
     unchanged.  The other callers (linker-script preprocessing in the
     top-level CMakeLists and libs/libc/elf) just get their depfiles in
     the new location.
   - **Hardware**: None.
   - **Documentation**: None.
   - **Security & Compatibility**: None.
   
   ## Testing
   
   `sim:nsh` (CMake, Ubuntu 22.04):
   
   ```
   cmake -B build -DBOARD_CONFIG=sim:nsh -G Ninja
   cmake --build build -j
   ./build/nuttx
   ```
   
   Before:
   
   ```
   nsh> ls /etc/init.d
   /etc/init.d:
    init.rc
    init.rc.d
   ```
   
   After:
   
   ```
   nsh> ls /etc/init.d
   /etc/init.d:
    init.rc
   ```
   
   Signed-off-by: Junbo Zheng <[email protected]>
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

  • [PR] cmake: keep preprocess d... Junbo-Zheng (via GitHub) via commits

Reply via email to