Results 1 to 6 of 6

Thread: qmake INSTALLS creates dangerous makefile

  1. #1
    Join Date
    Jan 2010
    Posts
    11
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default qmake INSTALLS creates dangerous makefile

    Hi all.
    i have a qmake project file that is generating a strange Makefile.

    the interesting part of the .pro is:
    Qt Code:
    1. headers.path = /usr/local/include/gdata
    2. headers.files = common/*.h contacts/*.h
    3.  
    4. binaries.path = /usr/local/lib
    5. binaries.files = libgdata.so*
    6.  
    7. INSTALLS += headers binaries
    To copy to clipboard, switch view to plain text mode 

    and here is the generated Makefile (only interesting part):
    Qt Code:
    1. ####### Install
    2.  
    3. install_headers: first FORCE
    4. @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/local/include/gdata/ || $(MKDIR) $(INSTALL_ROOT)/usr/local/include/gdata/
    5. # MORE FILES HERE
    6. -$(INSTALL_FILE) /home/whites/qtcreator/workspace/libgdata-cpp/contacts/webrequestmanager.h $(INSTALL_ROOT)/usr/local/include/gdata/
    7.  
    8.  
    9. uninstall_headers: FORCE
    10. -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/include/gdata/httprequestmanager.h
    11. #MORE FILES HERE
    12. -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/include/gdata/webrequestmanager.h
    13. -$(DEL_DIR) $(INSTALL_ROOT)/usr/local/include/gdata/
    14.  
    15.  
    16. install_binaries: first FORCE
    17. @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/local/lib/ || $(MKDIR) $(INSTALL_ROOT)/usr/local/lib/
    18. -$(INSTALL_PROGRAM) /home/whites/qtcreator/workspace/libgdata-cpp/libgdata.so $(INSTALL_ROOT)/usr/local/lib/
    19. -$(INSTALL_PROGRAM) /home/whites/qtcreator/workspace/libgdata-cpp/libgdata.so.0 $(INSTALL_ROOT)/usr/local/lib/
    20. -$(INSTALL_PROGRAM) /home/whites/qtcreator/workspace/libgdata-cpp/libgdata.so.0.0 $(INSTALL_ROOT)/usr/local/lib/
    21. -$(INSTALL_PROGRAM) /home/whites/qtcreator/workspace/libgdata-cpp/libgdata.so.0.0.1 $(INSTALL_ROOT)/usr/local/lib/
    22.  
    23.  
    24. uninstall_binaries: FORCE
    25. -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/lib/libgdata.so
    26. -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/lib/libgdata.so.0
    27. -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/lib/libgdata.so.0.0
    28. -$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/lib/libgdata.so.0.0.1
    29. -$(DEL_DIR) $(INSTALL_ROOT)/usr/local/lib/
    30.  
    31.  
    32. install: install_headers install_binaries FORCE
    33.  
    34. uninstall: uninstall_headers uninstall_binaries FORCE
    35.  
    36. FORCE:
    To copy to clipboard, switch view to plain text mode 

    the installation part is ok, but the uninstall is not, because of this line:

    Qt Code:
    1. -$(DEL_DIR) $(INSTALL_ROOT)/usr/local/lib/
    To copy to clipboard, switch view to plain text mode 

    of course this line is not a good idea.
    where's the problem?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: qmake INSTALLS creates dangerous makefile

    Why is it not a good idea?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jan 2010
    Posts
    11
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qmake INSTALLS creates dangerous makefile

    your question makes me think that i misunderstood the sense of that line.
    in my mind, when i call "make uninstall" i expect to get this executed:

    Qt Code:
    1. rm -rf /usr/local/lib/
    To copy to clipboard, switch view to plain text mode 

    which is not good, because /usr/local/lib may contain other files than the ones installed by make install.

    is this wrong?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: qmake INSTALLS creates dangerous makefile

    It's more likely you will get "rmdir /usr/local/lib" which is quite safe.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jan 2010
    Posts
    11
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qmake INSTALLS creates dangerous makefile

    hi.
    i verified and you're right.

    DEL_DIR = rmdir

    so that command is perfectly safe

    thanks

  6. #6
    Join Date
    Oct 2011
    Location
    Australia
    Posts
    29
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: qmake INSTALLS creates dangerous makefile

    Actually this bit me in the arse. I used:

    Qt Code:
    1. etc.files = conf/*
    2. etc.path = etc/
    To copy to clipboard, switch view to plain text mode 

    Where conf/ dir had a partial subtree of directories to deploy to etc/ like `init.d/`. On uninstall Qt rm my `/etc/init.d/` .

Similar Threads

  1. makefile without using QMake
    By Rayven in forum Qt Programming
    Replies: 2
    Last Post: 6th April 2010, 23:04
  2. qmake outputting wrong kind of makefile...
    By andy.fillebrown in forum Qt Programming
    Replies: 1
    Last Post: 21st September 2009, 17:37
  3. Qmake for subdirs w/ custom makefile name
    By Frank J. Lhota in forum Qt Tools
    Replies: 1
    Last Post: 10th June 2009, 01:59
  4. qmake INSTALLS and subdirs template ...
    By sandros in forum Qt Programming
    Replies: 1
    Last Post: 24th October 2007, 23:10
  5. qmake creat Makefile.Debug has error
    By freegnu in forum Qt Programming
    Replies: 4
    Last Post: 12th June 2006, 08:31

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.