make runs the downloader; the downloader chooses how to use a proxy. For GNU make, export the variables at Makefile scope when every relevant recipe should receive them:

export http_proxy := http://proxy.example:8080
export https_proxy := http://proxy.example:8080

fetch:
	curl --fail --output package.tar.gz https://downloads.example/package.tar.gz

The recipe line starts with a tab. The export directives belong to make's syntax and pass the values into commands' environments.

A shell export on one recipe line normally disappears before the next line, because GNU make invokes a separate shell for each line. For one command, use a shell assignment directly with that command instead:

fetch:
	http_proxy=http://proxy.example:8080 https_proxy=http://proxy.example:8080 curl --fail https://downloads.example/package.tar.gz

Use the downloader's documented variable names and proxy protocol. If the build can use a public HTTP endpoint, choose a candidate from the HTTP proxy list for those environment values. An executable that ignores these variables needs its own proxy option. Credentials are better supplied through the build environment than committed to the Makefile.

These exports affect child commands. They do not change the parent terminal's environment after make exits.

Tënë sô zo