PDA

View Full Version : Does qmake support make install option?



hakermania
30th October 2010, 20:04
the usual commands for compiling are
qmake -project
qmake name.pro
qmake
make

I need to enable after giving 'make' a 'make install' command so to do some actions.
Is it possible, and if yes, how do I enable it?:confused:

Lykurg
30th October 2010, 20:18
See the INSTALLS variable of a pro file.

hakermania
30th October 2010, 20:40
I opened a pro file and it contained only
TEMPLATE
TARGET
DEPENDPATH
INCLUDEPATH
HEADERS
FORMS
SOURCES
RESOURCES
:(

wysota
30th October 2010, 20:55
I opened a pro file and it contained only
TEMPLATE
TARGET
DEPENDPATH
INCLUDEPATH
HEADERS
FORMS
SOURCES
RESOURCES
:(

That's probably why your Makefile doesn't contain any install rules :cool:

Undocumented qmake

hakermania
30th October 2010, 21:41
actually, I found this that helped me a bit:
http://doc.qt.nokia.com/4.3/qmake-environment-reference.html#installs
and i put this into the Makefile(which is real, generated from real program and containing a lot of raws)
:
documentation.path = to/
documentation.files = from/*
INSTALLS += documentation
...
...
####### Install

install: $(INSTALLS)
uninstall: FORCE
FORCE:

I've placed a file to from/ and I want it to be copied to to/
but when I give make install it says make: *** No rule to make target `documentation', needed by `install'. Stop.

What do I do wrong?

wysota
30th October 2010, 21:53
It doesn't work this way. documentation.files should point to a variable containing a list of files to copy (you can use wildcards). The files in question have to exist (at least by default) when qmake is called.

hakermania
30th October 2010, 22:01
Can you make me a simple example of moving all files from 'from' to 'to' so to understand better? :eek:

wysota
30th October 2010, 22:06
FILESTOCOPY = from/*
documentation.path = to
documentation.from = FILESTOCOPY
INSTALLS += documentation

Disclaimer: not tested...

hakermania
30th October 2010, 22:19
Thank you, but still same error :/

wysota
30th October 2010, 22:41
Here is a working example:
FILESTOCOPY = f1 f2 f3
INSTRULE.path = /tmp
INSTRULE.files = $$FILESTOCOPY
INSTALLS += INSTRULE

hakermania
31st October 2010, 07:18
That's the created Makefile (using your last answer):
################################################## ###########################
# Makefile for building: some-1
# Generated by qmake (2.01a) (Qt 4.7.0) on: Sat Oct 30 23:31:32 2010
# Project: some-1.0.pro
# Template: app
# Command: /usr/bin/qmake -o Makefile some-1.0.pro
################################################## ###########################

####### Compiler, tools and options

CC = gcc
CXX = g++
DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -I.
LINK = g++
LFLAGS = -Wl,-O1
LIBS = $(SUBLIBS) -L/usr/lib -lQtGui -lQtCore -lpthread
AR = ar cqs
RANLIB =
QMAKE = /usr/bin/qmake
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
SED = sed
COPY_FILE = $(COPY)
COPY_DIR = $(COPY) -r
STRIP = strip
INSTALL_FILE = install -m 644 -p
INSTALL_DIR = $(COPY_DIR)
INSTALL_PROGRAM = install -m 755 -p
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p

FILESTOCOPY = from/*
INSTRULE.path = to/
INSTRULE.files = $$FILESTOCOPY
INSTALLS += INSTRULE
...
...
...
install: $(INSTALLS)

uninstall: FORCE

FORCE:
output of make install:

make: *** No rule to make target `INSTRULE', needed by `install'. Stop.

tbscope
31st October 2010, 07:26
This works for me:


installfiles.files += a.a
installfiles.files += b.b
installfiles.files += c.c
installfiles.path = /path/to/install/folder
INSTALLS += installfiles

Where a.a, b.b, c.c are your files, whatever they are called.

Clean the build dir
Rerun qmake
rerun make
then do: make install

hakermania
31st October 2010, 08:37
Thanks for your answer,
If I add what you told me without adding install: $(INSTALLS)
it outputs make: Nothing to be done for `install'.
If I add what you told me and I add install: $(INSTALLS)
it outputs make: *** No rule to make target `installfiles', needed by `install'. Stop.
Am I missing something?:confused:

wysota
31st October 2010, 08:37
You have to put those rules in the .pro file, not in the resulting Makefile.

hakermania
31st October 2010, 08:52
I though it had to do with the makefile. Cool. Now it works :) You are very helpful :)