Skip to content
On this page

Makefile

A Makefile is a text file that contains a set of instructions or rules for building and managing software projects. It is primarily used in Unix-based operating systems, although it can also be used on other platforms with compatible tools.

makefile
test:
	go test ./...

test-e2e:
	go test --tags=e2e ./...

test-integration:
	go test --tags=integration ./...

install:
	go get

Command: test-e2e

Run end-to-end tests.

shell
go test --tags=e2e ./...

Command: test-integration

Run integration tests.

shell
go test --tags=integration ./...

Command: install

Install dependencies.

shell
go get

Execute

To execute a Makefile, you need to use the make command followed by the target you want to build or execute. Here's the basic syntax:

make [target]

By default, if you run make without specifying a target, it will execute the first target defined in the Makefile. However, it's common practice to have a target named all as the first target, which serves as the default target.

Here are some examples of how to execute a Makefile:

  1. Execute the default target:

    make
  2. Execute a specific target:

    make test

    This will execute the test target in the Makefile.

  3. Execute a specific target with additional options:

    make test-e2e

    This will execute the test-e2e target in the Makefile.

Make will evaluate the Makefile and determine the dependencies and commands needed to fulfill the specified target. It will then execute the necessary commands in the specified order.

Makefiles can be powerful tools for managing complex build processes, dependencies, and other tasks in software projects.

Maintained by Passakon Puttasuwan & Dev Core Team.