Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Should "make install" (as on linux) avoid hard wired path in makefile with $(INSTALL_FILE) ?
QtWS25 Last Chance

Should "make install" (as on linux) avoid hard wired path in makefile with $(INSTALL_FILE) ?

Scheduled Pinned Locked Moved Installation and Deployment
2 Posts 1 Posters 1.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    simon-h
    wrote on last edited by
    #1

    I'm puzzled on what I should expect to happen with "make install" of a linux-built Qt application.
    I presume that I would do the following:

    1. make # in directory /myroot
    2. make dist # builds a tar file of sources etc and things named in DISTFILES
    3. put tar file on another machine

    4. untar it in another directory not called /myroot

    5. make
    6. make install # copies files to intended destination, or
      make install INSTALL_ROOT=/alternative/rootpath

    The default destination is intended to be /myroot/bin

    The documentation explains how to add things to the INSTALLS variables in the .pro file.
    qmake generates a Makefile.
    Makefile lines containing $(INSTALL_PROGRAM) use (correctly I believe) a relative source path; whereas
    Makefile lines containing $(INSTALL_FILE) use (incorrectly I believe) an absolute source path.
    Destination paths are ok, being relative to $(INSTALL_ROOT) which can be set on command line of make.

    E.g.
    /myroot/myApp.pro

    TARGET myApp
    ...
    target.path = ./bin # i.e. install into /myroot/bin
    config.path = ./config # i.e. install linto /myroot/config
    config.files = config/setup.txt # source
    INSTALLS += target config_files

    Makefile

    INSTALL_FILE = install -m 644 -p
    INSTALL_DIR = $(COPY_DIR)
    INSTALL_PROGRAM = install -m 755 -p
    .
    .
    .
    install_target: first FORCE
    @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/myroot/./bin/ || $(MKDIR) $(INSTALL_ROOT)/myroot/myApp/./bin/
    -$(INSTALL_PROGRAM) "bin/$(QMAKE_TARGET)" "$(INSTALL_ROOT)/myroot/myApp/bin/$(QMAKE_TARGET)"
    ...
    install_config_files: first FORCE
    @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/myroot/myApp/./config/ || $(MKDIR) $(INSTALL_ROOT)/myroot/myApp/./config/
    -$(INSTALL_FILE) /myroot/myApp/config/setup.txt $(INSTALL_ROOT)/myroot/myApp/./config/

    above line looks wrong

    ...
    install: install_target install_config_files FORCE

    Is it the case that the makefile really ought to be using a relative path (relative to untarred tar file) as the first path parameter to $(INSTALL_FILE) ?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      simon-h
      wrote on last edited by
      #2

      oops: in the above pasted coded block, the Makefile lines lost the new-line before the command lines starting -$(INSTALL_PROGRAM) and -$(INSTALL_FILE) when pasted; and I can't see how to force that newline in this wiki editor without extra blank lines (here it is again):

      install_target: first FORCE @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/myroot/./bin/ || $(MKDIR) $(INSTALL_ROOT)/myroot/myApp/./bin/

      -$(INSTALL_PROGRAM) “bin/$(QMAKE_TARGET)” “$(INSTALL_ROOT)/myroot/myApp/bin/$(QMAKE_TARGET)”
      …

      install_config_files: first FORCE @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/myroot/myApp/./config/ || $(MKDIR) $(INSTALL_ROOT)/myroot/myApp/./config/

      -$(INSTALL_FILE) /myroot/myApp/config/setup.txt $(INSTALL_ROOT)/myroot/myApp/./config/

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved