-- Leo's gemini proxy

-- Connecting to ayushnix.com:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

GNU Make and bmake


I was trying to create a Makefile for a personal project when I recalled that bmake exists, a portable version of make from NetBSD. bmake seems quite similar to OpenBSD's make as well. I was interested in making my Makefile portable and compatible with both GNU Make and bmake but I quickly ran into a roadblock.


bmake

OpenBSD make man page


GNU Make uses "$^" as an automatic variable to expand into the list of all prerequisites (sometimes called dependencies or sources) provided to a target but bmake uses "$>" to do the same thing. Here's a simple Makefile.


myfile: file1 file2
	cat file1 file2 > myfile

automatic variables in GNU Make


The second line of this Makefile can be rewritten as "cat $^ > $@" for GNU Make. However, it needs to be written as "cat $> > $@" for bmake. "$@" is the name of the target, which is myfile.


It looks like I can either


not use automatic variables and write all the sources manually

or write Makefiles to be either GNU Make compatible or bmake compatible


Am I missing something?


---


Created: 2022-09-08


MicroGemlog

Home

-- Response ended

-- Page fetched on Mon May 20 19:34:42 2024