Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

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

    Installation and Deployment
    1
    2
    1592
    Loading More Posts
    • 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
      simon-h last edited by

      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 Reply Quote 0
      • S
        simon-h last edited by

        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 Reply Quote 0
        • First post
          Last post