nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.45k stars 278 forks source link

Questions about GYP and Makefile in Node.js #4242

Closed jasonjiicloud closed 1 month ago

jasonjiicloud commented 10 months ago

Details

Hi, everyone,

I'm a Node.js researcher, I'm working on helping developers in my country to learn Node.js more easily.

When I read Node.js source code, I found Node.js uses GYP to build, but I also found that there’s a big Makefile, it has thousands of lines.

I have two questions:

  1. We already have GYP, why do we need a Makefile? We can use GYP to do anything. Or why don't we remove GYP, only use Makefile to build Node.js(because V8 needs it?)?

  2. If I want to add a build related feature, which one should I use, adding it to GYP config file or Makefile?

Thank you in advance!

Node.js version

Not applicable.

Example code

No response

Operating system

Question about Node.js source code.

Scope

GYP and Makefile

Module and version

Not applicable.

preveen-stack commented 10 months ago

The functionality of GYP is similar to the CMake build tool. GYP processes a file that contains a JSON dictionary[2] in order to generate one or more target project make files. The single source .GYP file is generic while the target files are specific to each targeted build tool.

Ref https://en.wikipedia.org/wiki/GYP_(software) perhaps the above can answer your question

jasonjiicloud commented 10 months ago

@preveen-stack, thank you for help! Yes, you're right. Ah.. I know what GYP is used for, it can be used to generate Makefiles or xcodeproject file. But why does Node.js use GYP and Makefile in parallel? To my knowledge, we could remove that big Makefile, and move everything to GYP configure file.

preveen-stack commented 10 months ago

I guess it is probably evolved over time. One way to find out is to estimate the effort involved in going for a GYP only codebase

jasonjiicloud commented 10 months ago

Yeah, I guess so. Another reason maybe that GYP has already been deprecated, so new features will not be implemented by GYP anymore.

github-actions[bot] commented 2 months ago

It seems there has been no activity on this issue for a while, and it is being closed in 30 days. If you believe this issue should remain open, please leave a comment. If you need further assistance or have questions, you can also search for similar issues on Stack Overflow. Make sure to look at the README file for the most updated links.

github-actions[bot] commented 1 month ago

It seems there has been no activity on this issue for a while, and it is being closed. If you believe this issue should remain open, please leave a comment. If you need further assistance or have questions, you can also search for similar issues on Stack Overflow. Make sure to look at the README file for the most updated links.