Should "make install" (as on linux) avoid hard wired path in makefile with $(INSTALL_FILE) ?
-
wrote on 20 Mar 2012, 09:35 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:- make # in directory /myroot
- make dist # builds a tar file of sources etc and things named in DISTFILES
-
put tar file on another machine
-
untar it in another directory not called /myroot
- make
- 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.proTARGET 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_filesMakefile
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 FORCEIs 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) ?
-
wrote on 20 Mar 2012, 09:44 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/2