Using make - newbie

Hello,
I have a Makefile that is working on MacOS and not on FreeBSD.
1. $(RM)
From what I have understood $(RM) is a variable which is commonly defined somewhere for designing rm -f. Looks like it is not defined on my distrib. If I want, where should I go/see/modify to define this variable outside this make.

2. Using "shell" word/variable
Picked somewhere on internet I ended with :
Code:
DISTRIB=myprog-$(shell git describe --always).tar.gz
package: clean
              tar -czf $(DISTRIB) $(MY_SOURCES)
But it does not work on FreeBSD. The git version is not displayed. Why and what should I do ?
Again Why I should use "shell" keyword" ? I used "rm -f" before and not "shell rm -f"

3. Conditional
I was looking at the Makefile from Google gRPC project which I have understood is using (GNU)make and is not compatible on FreeBSD.
So I started writing my own with a (BSD ???) style (same as PMake ???) :
Code:
HAS_GCC = $(shell which gcc > /dev/null 2> /dev/null && echo true || echo false)
HAS_CC = $(shell which cc > /dev/null 2> /dev/null && echo true || echo false)
TRUE= $(echo true)
FALSE = $(echo false)
.if $(HAS_CC) == $(TRUE)
@echo hello
.else echo "hello sweety again"
.endif
And again, it does not work. No Hello, No sweety... Why and how to solve :)

4. using along GNU make / BSD make
From this thread https://forums.freebsd.org/threads/48534/, the moderator answered :
"It's quite common on FreeBSD to use devel/gmake. A lot of ports use it."
So my question is : Could I have 2 "Make" available in same time and switch between both.
And if yes, what is the procedure to do so; and at last can I build a library with one and use it in project built with the other ?

Hope you could help.
Olive
 
So my question is : Could I have 2 "Make" available in same time and switch between both.
By default you'll have make included in the base system (/usr/bin/make) and to get a good impression on what it can do all you have to do is check the make(1) manualpage.

GNU make (the "Linux variant") is no different from any other 3rd party software. It can be installed through the Ports collection or using online repositories. It would be installed as /usr/local/bin/gmake and as it's name implies it'll be easy to switch between the two.

Look into devel/gmake.
 
Back
Top