#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    9
    Rep Power
    0

    Using if in a makefile


    Hi guys,

    I have the following code in my Makefile:


    copy: PATFILES= $(shell find /pattern/ -name "*.PAT")

    copy:
    @echo "$(PATFILES)"
    ifneq "$(PATFILES)" ""
    gzip $(PATFILES)
    endif

    I want to search for PAT files in the folder /pattern. If any files are found, I want to gzip them.

    However the ifneq condition is not working, it always evaluates to false. I tried many options. What am I doing wring?
  2. #2
  3. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,407
    Rep Power
    1871
    http://www.gnu.org/software/make/man...tional-Example
    Take note of what it says about comparing variables which might consist only of white-space.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    9
    Rep Power
    0
    Originally Posted by salem
    http://www.gnu.org/software/make/man...tional-Example
    Take note of what it says about comparing variables which might consist only of white-space.
    tried split, still not working
  6. #4
  7. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,407
    Rep Power
    1871
    Look further down.
    Try strip() instead.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper

IMN logo majestic logo threadwatch logo seochat tools logo