this post was submitted on 12 Aug 2023
29 points (96.8% liked)

Linux

48323 readers
620 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

cross-posted from: https://lemmy.ml/post/3229278

Suppose I've got a simple #Makefile w/ a few URLs that I'd like to process as dynamic targets.

For example here is a not working snippet:

.DEFAULT_GOAL := all

#####
URLS  = https://foo.example.com
URLS += https://bar.example.com
URLS += https://www.example.org

#####
% :
	@echo the url is $(*)

#####
.PHONY : all
all : $(URLS)

It fails w/

*** target pattern contains no '%'

I believe that's b/c of the character : being part of URLS which confuses Make after expansion (order o

As a workaround, I've removed https:// from all URLs. For example this works:

URLS = foo.example.com
URLS += bar.example.com

I know Make generally doesn't play well w/ targets w/ space or colon in the name but I wonder if the above is the best I can do. What do you think?

you are viewing a single comment's thread
view the rest of the comments
[–] pnutzh4x0r@lemmy.ndlug.org 1 points 1 year ago (1 children)

I just tried it with GNU make 4.3 and it worked.

[–] bahmanm@lemmy.ml 2 points 1 year ago

Oh, it works 🎉 Thank you!

For posterity here's a complete example:

foo\:bar :
	@echo $(@)

and then

$ make foo:bar
foo:bar

Though, TBH, I don't understand how this works 🤦‍♂️ I need to look into Make docs.