Checking for ldconfig in make
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Checking for ldconfig in make

  1. #1
    Join Date
    Jan 2009
    Posts
    1,689

    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

  2. #2
    Join Date
    Jan 2009
    Posts
    596

    Re: Checking for ldconfig in make

    The error message you are getting:
    Quote Originally Posted by ninja9578 View Post
    ...
    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
    Code:
    Hello
    World!
    as expected.

  3. #3
    Join Date
    Jan 2009
    Posts
    1,689

    Re: Checking for ldconfig in make

    Oh, I didn't know that make was indentation sensitive

  4. #4
    Join Date
    Jan 2009
    Posts
    596

    Re: Checking for ldconfig in make

    Quote Originally Posted by ninja9578 View Post
    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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center