-
March 29th, 2012, 02:37 PM
#1
Checking for ldconfig in make
How do I check for ldconfig in a makefile?
This makefile errors because it tries to run ldconfig, even though OS = Darwin and I have no idea why
Code:
ifeq ($(SHARED),1)
install: banner install_headers $(lib_target)
@echo "Install shared library"
cp -f ./$(lib_target) $(inst_path)
cd $(inst_path) ; \
ln -sf $(lib_target) $(libname_shared_major_version) ; \
ln -sf $(libname_shared_major_version) $(libname_shared)
ifneq ($(OS),Darwin)
ldconfig
endif
@echo "Install shared library: Done."
else
install: banner install_headers $(lib_target)
@echo "Install static library"
cp -f ./$(lib_target) $(inst_path)
@echo "Install static library: Done."
endif
Errors
Code:
/bin/sh: -c: line 0: syntax error near unexpected token `Darwin,Darwin'
/bin/sh: -c: line 0: `ifneq (Darwin,Darwin)'
make: *** [install] Error 2
make: ldconfig: No such file or directory
make: *** [uninstall] Error 1
-
March 29th, 2012, 03:10 PM
#2
Re: Checking for ldconfig in make
The error message you are getting:
Originally Posted by ninja9578
...
Errors
Code:
/bin/sh: -c: line 0: syntax error near unexpected token `Darwin,Darwin'
/bin/sh: -c: line 0: `ifneq (Darwin,Darwin)'
make: *** [install] Error 2
make: ldconfig: No such file or directory
make: *** [uninstall] Error 1
is complaining about the ifneq($(OS),Darwin) line itself. So as it doesn't recognise this ifneq statement it runs on to the ldconfig regardless.
This is caused by a problem with the indenting - you shouldn't be indenting the OS check. Here is an example to show you. This code:
Code:
install:
@echo "Hello "
ifeq (1,1)
@echo "World!"
endif
gives this error:
Code:
Hello
ifeq (1,1)
/bin/sh: -c: line 0: syntax error near unexpected token `1,1'
/bin/sh: -c: line 0: `ifeq (1,1)'
make: *** [install] Error 2
which is similar to that which you are getting. To make it work, unindent the ifeq block:
Code:
install:
@echo "Hello "
ifeq (1,1)
@echo "World!"
endif
which outputs
as expected.
-
March 29th, 2012, 03:46 PM
#3
Re: Checking for ldconfig in make
Oh, I didn't know that make was indentation sensitive
-
March 29th, 2012, 04:22 PM
#4
Re: Checking for ldconfig in make
Originally Posted by ninja9578
Oh, I didn't know that make was indentation sensitive
Yes, it is unfortunately. You have to use a tab to indent (which you are doing) rather than spaces also.
Definitely not the best design decision ever made...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|