How to declare compilation dependencies manually?

How can I declare a (module) dependency manually without requireing it?

I have found the function register-external-module, but it only adds an additional dependency after the code has been compiled. In other words, the new dependencies work only after re-compilation.

Here is an example code that demonstrates the problem:

;; main.rkt
#lang racket/base
(require (for-syntax racket/base compiler/cm-accomplice))
(define-syntax (ghost-require stx)
  (syntax-case stx ()
    [(_ relative-path)
     (register-external-module (path->complete-path (syntax-e #'relative-path)))
     #'(begin)]))

(ghost-require "ext.rkt")

I hope that compiling main.rkt using raco make would trigger the compilation of ext.rkt, while instantiating main.rkt itself would not load or instantiate ext.rkt. Is this possible? With ghost-require, I need to compile make.rkt twice to actually compile ext.rkt.

$ raco make -v main.rkt 
"main.rkt":
  making #<path:...cm/main.rkt>
 [output to "compiled/main_rkt.zo"]
$ ls compiled 
main_rkt.dep  main_rkt.zo
$ raco make -v main.rkt 
"main.rkt":
  making #<path:...cm/ext.rkt>
  making #<path:...cm/main.rkt>
 [output to "compiled/main_rkt.zo"]
$ ls compiled 
ext_rkt.dep   ext_rkt.zo    main_rkt.dep  main_rkt.zo
$ 

i'm not sure this fits all your requirements, but maybe a submodule could help, such as

(module compile-deps racket/base (require "ext.rkt"))

This will make ext.rkt a dependency of main.rkt, but instantiating the latter should not instantiate the former I guess?