I have a single Makefile.
On a FreeBSD machine with both gmake and make installed, I run the same Makefile using both tools.
The output log for make and gmake is not the same. Why is this? And how can I "fix" this?
The logs are below:
$ gmake
compile main.cpp
linking myout
$ make
c++ -O2 -pipe -c main.cpp -o main.o
linking myout
$ cat Makefile
TARGET = myout
default: $(TARGET)
SRCS = main.cpp
OBJS = $(SRCS:%.cpp=%.o)
default: $(BIN)
%.o: %.cpp
@echo compile $<
@$(CXX) -c $< -o $@
$(TARGET): $(OBJS)
@echo linking $@
@$(CXX) $(OBJS) -o $@
clean:
@rm -f $(OBJS) $(TARGET)
The default build utilities are different. FreeBSD uses a different implementation of make than GNU/Linux. The respective man pages outline differences.
https://forums.freebsd.org/threads/difference-gmake-gnu-and-freebsd-make.28784/