Removing dependencies from a Makefile

Will

We have scripts that use gccmakedep, which fill up the Makefile with dependencies based on the system it was last run on.

How can we make the clean target in the Makefile automatically remove the dependencies that gccmakedep has added to the Makefile?

(I cannot have a command in the clean target that searches itself for the "# DO NOT DELETE" divider, as gccmakedep itself will find that argument and think that's where it should chop...?)

Marek Vavrusa

I think you can make gccmakedep -fdepends.mk produce output into a different makefile. Then you can include it, and remove on clean rule.

-include depends.mk
clean:
    @rm -f depends.mk

Personally, I use cc -MMD -MP to generate .d depends and include them in the Makefile. It doesn't need any extra tools and you can clean the .d files along with the object files. Here's an example.

This is also a good writeup by Scott McPeak for more portable solutions and explanation.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Target dependencies from variable in Makefile

From Dev

Removing source dependencies after building from source

From Dev

Makefile filter-out not removing a file from a list of files

From Dev

Removing multiple files from directory, as specified by variable in Makefile

From Dev

Makefile with auto-dependencies

From Dev

Makefile wildcard dependencies

From Dev

Installing dependencies in makefile

From Dev

Makefile is skipping certain dependencies

From Dev

Dependencies not being made in makefile

From Dev

Makefile with auto-dependencies

From Dev

Makefile order of dependencies

From Dev

Makefile with multiple executables and dependencies

From Dev

DPKG dependencies problem after removing MariaDB, prevents me from using apt-get

From Dev

DPKG dependencies problem after removing MariaDB, prevents me from using apt-get

From Dev

makefile with multiple dependencies for a single file

From Dev

Makefile with multiple dependencies in directory tree

From Dev

makefile with multiple dependencies for a single file

From Dev

Understanding the Dependencies of a Makefile (C++)

From Dev

Makefile with multiple dependencies in directory tree

From Dev

Makefile with combinations of multiple targets and dependencies

From Dev

Auto-add 'requires' lines to Makefile.PL from dependencies used in a Catalyst application

From Dev

Checking if file exists before removing it in makefile

From Dev

Makefile: Run other makefile from makefile

From Java

How to disable all Kafka related auto configuration from yaml/properties file in spring-boot-2 without removing dependencies?

From Dev

How to remove a deb without removing its dependencies

From Dev

Removing boot packages while ignoring dependencies

From Dev

Failure while removing unwanted packages/configurations/dependencies

From Dev

How to remove a deb without removing its dependencies

From Dev

How to fix unmet dependencies after removing python?

Related Related

  1. 1

    Target dependencies from variable in Makefile

  2. 2

    Removing source dependencies after building from source

  3. 3

    Makefile filter-out not removing a file from a list of files

  4. 4

    Removing multiple files from directory, as specified by variable in Makefile

  5. 5

    Makefile with auto-dependencies

  6. 6

    Makefile wildcard dependencies

  7. 7

    Installing dependencies in makefile

  8. 8

    Makefile is skipping certain dependencies

  9. 9

    Dependencies not being made in makefile

  10. 10

    Makefile with auto-dependencies

  11. 11

    Makefile order of dependencies

  12. 12

    Makefile with multiple executables and dependencies

  13. 13

    DPKG dependencies problem after removing MariaDB, prevents me from using apt-get

  14. 14

    DPKG dependencies problem after removing MariaDB, prevents me from using apt-get

  15. 15

    makefile with multiple dependencies for a single file

  16. 16

    Makefile with multiple dependencies in directory tree

  17. 17

    makefile with multiple dependencies for a single file

  18. 18

    Understanding the Dependencies of a Makefile (C++)

  19. 19

    Makefile with multiple dependencies in directory tree

  20. 20

    Makefile with combinations of multiple targets and dependencies

  21. 21

    Auto-add 'requires' lines to Makefile.PL from dependencies used in a Catalyst application

  22. 22

    Checking if file exists before removing it in makefile

  23. 23

    Makefile: Run other makefile from makefile

  24. 24

    How to disable all Kafka related auto configuration from yaml/properties file in spring-boot-2 without removing dependencies?

  25. 25

    How to remove a deb without removing its dependencies

  26. 26

    Removing boot packages while ignoring dependencies

  27. 27

    Failure while removing unwanted packages/configurations/dependencies

  28. 28

    How to remove a deb without removing its dependencies

  29. 29

    How to fix unmet dependencies after removing python?

HotTag

Archive