Skip to content

add rules for building C-based executables #1730

@avsm

Description

@avsm

I have a library (ctypes) that uses install_c_headers to install its headers along with the rest of the library.

Now I need to pass in a -I to a cc invocation to locate the directory with those headers, but I'm unable to figure out the right rule for this.

Trying to use:

  • %{lib:ctypes} fails as it needs a third argument of a file (but I want the directory for -I
  • %{lib:ctypes:} fails as it is unable to depend on the directory
  • %{dep:../../src/ctypes} fails for the same reason as above and is unable to depend on the directory

I'd like to avoid the relative path solution if possible as that makes it harder to separate the libraries in a duniverse. Is there a way to retrieve the directory into which install_c_headers puts the header files in a rule? For reference my rule is:

(rule
  (targets generated_struct_stubs%{ext_exe})
  (deps generated_struct_stubs.c)
  (action (run %{cc} -o %{targets} %{deps})))

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions