我喜欢Makefiles

I like makefiles. I first used a makefile more than ten years ago. Even back then, it looked like some ancient technology used by the graybeard Linux wizards. Years passed, and new build tools came and went, but I kept seeing makefiles still used here and there. I got used to them because they were part of some projects I joined. At some point, I started to like them. Today, they are often the first automation tool I use when I start a new project.

我喜欢makefile。我第一次使用makefile是在十多年前。即使在那时,它看起来像是一些古老的技术,被那些有经验的Linux高手使用。多年过去了,新的构建工具来了又去,但我仍然在这里那里看到makefile的使用。我习惯了它们,因为它们是我加入的一些项目的一部分。在某个时候,我开始喜欢上它们。今天,它们通常是我开始新项目时使用的第一个自动化工具。

The reason I like makefiles is that they often follow an unwritten convention of implementing the same set of commands to get you up and running. When I find a project I know nothing about, and I see a Makefile file inside, chances are that I can run make or make build followed by make install, and I will get this project built and set up on my computer. Or at least I will get information on other steps I need to include.

我喜欢makefile的原因是它们通常遵循一个未成文的约定,实施一套相同的命令来让你启动和运行。当我发现一个我一无所知的项目,并且我看到里面有一个Makefile文件时,很可能我可以运行makemake build,然后是make install,我就可以在我的电脑上构建并设置这个项目。或者至少我会得到关于我需要包含的其他步骤的信息。

I try to apply the same rule in my projects. If I open a folder with one of my old projects and run make dev, this will perform all the necessary steps to build the project and spin up a dev server. That's convenient because throughout the years, I used many different technologies, and each had different commands to build or deploy a project. I have old projects written in Jekyll, Hugo, 11ty, and all sorts of different Python web frameworks. With makefiles, when I come back to a project I haven't touched for months (or years), I don't have to remember the command to start a dev server with, let's say, Jekyll. I just run make dev, and this, in turn, fires up the corresponding Bundler commands. Even if I use tools like Docker or gulp in my project, I still use makefiles to orchestrate those tools. For example, ...

开通本站会员,查看完整译文。

Home - Wiki
Copyright © 2011-2024 iteam. Current version is 2.139.0. UTC+08:00, 2024-12-22 18:52
浙ICP备14020137号-1 $Map of visitor$