Sample Header Ad - 728x90

Is there any possibility to use the same Makefile in CentOS and FreeBSD?

1 vote
1 answer
405 views
Unfortunately, in some old FreeBSD environments I can't use "gmake", so I need to write a Makefile which will work with FreeBSD make also. And the last problem I can't solve - use shell commands, for example, I need to get full path to Python executable: PYTHON := $(shell which python2.7 || which python) But FreeBSD make simply ignores this. test: echo == $(PYTHON) == Then I run make test: $ make test echo == == == == Can anyone help, please? **Update #1:** To those who can't read closely and accidentally downvotes the question: Whole test script: PYTHON != which python2.7 || which python test: $(PYTHON) -c 'print "hello world"' Run on FreeBSD: make /usr/bin/python -c 'print "hello world"' hello world Run on CentOS: make test_make:1: *** missing separator. Stop. And if I use command $(shell ...) it works on CentOS and doesn't work on FreeBSD. So, is there any solution without gmake? **Update #2:** Eventually I found solution (put command in backticks): PYTHON ?= which python2.7 || which python I don't know why it prints itself: make which python2.7 || which python -c 'print "hello world"' hello world But it works! You can use it, guys :)
Asked by Sergius (833 rep)
Sep 18, 2018, 03:07 PM
Last activity: Jan 27, 2023, 10:42 AM