Skip to main content

Deps

Struct Deps 

Source
pub struct Deps {
    pub emit: bool,
    pub instead_of_compiling: bool,
    pub system_headers: bool,
    pub file: Option<String>,
    pub targets: Vec<String>,
    pub phony: bool,
}
Expand description

What the -M family asks for, which is a make rule saying what a source file was built from.

Design: spec/04-driver-and-cli.md section 4.4.

This is a compiler flag rather than a separate tool because the answer is the set of files the preprocessor opened, and nothing outside the preprocessor knows what that was. A build system that generates its own makefiles asks for it on every compilation, which is why section 4.4 calls the family required rather than convenient.

Fields§

§emit: bool

Whether a rule is produced at all, which is any of -M, -MM, -MD and -MMD.

§instead_of_compiling: bool

Whether the rule is produced instead of compiling, which is -M and -MM and not the two that end in D.

The split is GCC’s and it is about who reads the answer. The two that stop after the rule write it to standard output for a person, and the two that do not write it to a file beside the object for make to include on the next run.

§system_headers: bool

Whether a header found in a system directory is listed, which -MM and -MMD turn off.

A build that lists them is a build that rebuilds the world when the C library is updated, which is either what somebody wanted or the reason they reached for the other spelling.

On unless a flag turned it off, and nothing turns it back on. That is GCC’s behaviour and not an oversight: -MM -M leaves the system headers out, because the flag that asks for fewer of them is read as the answer to a question the other one never asked.

§file: Option<String>

Where the rule is written, from -MF, with - meaning standard output.

None is the default, which is standard output when the rule replaces the compilation and the output file with a .d suffix when it does not.

§targets: Vec<String>

What the rule’s targets are, from -MT and -MQ, in the order they were given.

Already escaped, because that is the whole of the difference between the two flags: -MQ escapes what it is given and -MT writes it through untouched. Empty means the target is worked out from the output file, which is what a build that passes neither expects.

§phony: bool

Whether every prerequisite except the source gets a target of its own with no recipe, from -MP.

This is what stops make failing outright when a header is deleted. Without it the old rule names a file that is gone and no rule makes it, and the build stops on a header that nothing needs any more.

Trait Implementations§

Source§

impl Clone for Deps

Source§

fn clone(&self) -> Deps

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Deps

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Deps

Source§

fn default() -> Deps

Returns the “default value” for a type. Read more
Source§

impl Eq for Deps

Source§

impl PartialEq for Deps

Source§

fn eq(&self, other: &Deps) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Deps

Auto Trait Implementations§

§

impl Freeze for Deps

§

impl RefUnwindSafe for Deps

§

impl Send for Deps

§

impl Sync for Deps

§

impl Unpin for Deps

§

impl UnsafeUnpin for Deps

§

impl UnwindSafe for Deps

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.