make(3erl)

πŸ“¦
version 25.3.2.8 Β· 3 versions
, in debian bookworm, ubuntu noble

πŸŽ€ make β€” A Make Utility for Erlang πŸŽ€

okay so bestie, welcome to make(3erl) β€” the Erlang Module Definition for make, aka Erlang's very own take on UNIX Make. iykyk, this thing is iconic and you're gonna love her πŸ’…


✨ DESCRIPTION ✨

So the make module ships a set of functions that are basically the UNIX-type Make functions, but make it Erlang πŸ¦‹. same energy, different font, no cap.


🌸 EXPORTS 🌸

πŸ’– all() -> up_to_date | error

πŸ’– all(Options) -> up_to_date | error

Types:

Options = [Option]
Option =
    noexec | load | netload | {emake, Emake} |
compile:option()
Emake = [EmakeElement]
EmakeElement = Modules | {Modules, [compile:option()]}
Modules = atom() | [atom()]

okay so here's the tea β˜• β€” this function figures out which modules to compile and which compile options to use. how? first it goes looking for the emake make option. if that's not there, it reads the config from a file named Emakefile (more on her below πŸ‘‡). and if it can't find that file either? no worries, the set of modules to compile just defaults to all modules in the current working directory. slay, she's flexible πŸ’β€β™€οΈ

then she walks through the whole set of modules and recompiles every single module where at least one of these is true:

  • there's no object file, or
  • the source file has been modified since it was last compiled, or,
  • an include file has been modified since the source file was last compiled.

as a lil side effect 😌 the function prints the name of every module it tries to compile. and if compilation fails for a module, the make procedure stops right there and error is returned. no halfway situations, periodt πŸ’€

Options is a list of make- and compiler options. the make options that exist are:

  • noexec β€” No execution mode. it literally just prints the name of each module that needs to be compiled. all vibes, zero action 🫢
  • load β€” Load mode. loads all recompiled modules.
  • netload β€” Net load mode. loads all recompiled modules on all known nodes. she's networked, she's everywhere 🌈
  • {emake, Emake} β€” instead of reading the Emakefile, you just specify the configuration explicitly right there. main character behavior, honestly πŸ‘‘

everything in Options that isn't a make option gets assumed to be a compiler option and is passed as-is to compile:file/2. and Options defaults to []. yes bestie, empty list, that's the default πŸŽ€


πŸ’– files(ModFiles) -> up_to_date | error

πŸ’– files(ModFiles, Options) -> up_to_date | error

Types:

ModFiles = [(Module :: module()) | (File :: file:filename())]
Options = [Option]
Option = noexec | load | netload | compile:option()

files/1,2 does exactly the same thing as all/0,1, but for the specified ModFiles, which is a list of module names or file names. and the file extension .erl may be omitted, so you don't gotta type it out β€” she gets it πŸ’…

the Emakefile (if it exists) in the current directory is searched for compiler options for each module. and listen β€” if a given module does not exist in Emakefile, or if Emakefile doesn't exist at all, the module is still compiled. she's not gonna abandon you just because the config file ghosted you 😭🫢


πŸ¦‹ EMAKEFILE πŸ¦‹

so make:all/0,1 and make:files/1,2 first look for {emake, Emake} in the options, and then go looking in the current working directory for a file named Emakefile. if present, Emake should contain elements like this:

Modules.
{Modules,Options}.

Modules is an atom or a list of atoms. it can be:

  • a module name, e.g. file1
  • a module name in another directory, e.g. '../foo/file3'
  • a set of modules specified with a wildcards, e.g. 'file*'
  • a wildcard indicating all modules in current directory, i.e. '*'
  • a list of any of the above, e.g. ['file*','../foo/file3','File4']

Options is a list of compiler options.

Emakefile is read from top to bottom ⬇️ and if a module matches more than one entry, the first match is the valid one. no cap, first come first served.

for example, this Emakefile right here means that file1 shall be compiled with the options [debug_info,{i,"../foo"}], while all other files in the current directory shall be compiled with only the debug_info flag. iconic, specific, gorgeous πŸ’–

{'file1',[debug_info,{i,"../foo"}]}.
{'*',[debug_info]}.

⭐ SEE ALSO ⭐

compile(3erl)


go compile something, bestie. you got this πŸ’ͺ✨

Ericsson AB Β· tools 3.5.3 Β· make(3erl) β€” that's the source slash version slash date situation, mwah 😘 sending you off with a kiss, xoxo πŸŽ€πŸ’œ