Find the answer to your Linux question:
Results 1 to 4 of 4
I Have one Makefile like.. OBJS: a.o b.o c.o d.o clean: rm -rf $(OBJS) Here my question is, suppose if i do 'make clean' it will clean all object files, ...
  1. #1
    Just Joined!
    Join Date
    Nov 2006
    Location
    Hyderabad
    Posts
    85

    cleaning .o files

    I Have one Makefile like..

    OBJS: a.o b.o c.o d.o

    clean:
    rm -rf $(OBJS)

    Here my question is, suppose if i do 'make clean' it will clean all object files, but i want to do it with out removing a.o . how can we do this.

    thanks.

  2. #2
    Just Joined!
    Join Date
    Mar 2010
    Location
    Belgium
    Posts
    4
    If you do something like this:
    Code:
    FILES := b.o c.o d.o
    clean:
        rm -fr  $(foreach file,$(FILES),$(file))
    Or just get a.o out of your OBJS?

  3. #3
    Just Joined!
    Join Date
    Nov 2006
    Location
    Hyderabad
    Posts
    85
    You mean that keep the loop repeat and clean the file other than a.o.
    OK... thank you.

  4. #4
    Just Joined!
    Join Date
    Mar 2010
    Location
    Belgium
    Posts
    4
    Yes indeed

    Or just like your make-file, but remove a.o out of the OBJS list.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...