Is it possible to execute the Makefile itself?

Asked 2 years ago, Updated 2 years ago, 78 views

As a task runner, I often use Makefile.

If you want to run a process that is interactive for a long time, then you might want to run exec.More specifically, if you add various options to docker run and bash with -it.

Question

  • Is it possible to execute the Make process itself in the Makefile?

linux makefile

2022-09-30 11:02

2 Answers

I don't think I can.If it's an interactive process, it might be good to boot to the background using tmux(1) or screen (1).

This is not an example of Makefile, but is it like ↓?

https://stackoverflow.com/questions/33426159/starting-a-new-tmux-session-and-detaching-it-all-inside-a-shell-script

By the way, the first answer I received shows an example of make (1posix), but this example is not good.If you don't do ↓ like this, you won't be able to run tasks and it's dangerous.

.PHONY:subdir
subdir:
    cd subdir&rm all_the_files&$(MAKE)


2022-09-30 11:02

POSIX Programmer's Manual make statement contains a Makefile that is close to what you are looking for.

subdir:
   cd subdir;rm all_the_files;$(MAKE)

In the above entry, when the subdir target is invoked, it moves to the subdir directory, deletes the file, and then executes the $(MAKE) macro (make) command.


2022-09-30 11:02

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.