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



  • 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) ?



  • 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/


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.