make pkg

Hello,
Do you know how to specify that a rule defined at a level project should
be done only after all sub directories being processed?

I defined a :
EXTRA_TARGETS=pkg
to make my packages according to what I saw in recurse.mk line 67. (6.1)
When I execute make, it says that I override commands for target ‘pkg’. !?

Does this ‘pkg’ rule really exists? if yes what does it supposed to do?

Where are these mk files explained (rules, macros,…).

regards,
Alain.

Alain Bonnefoy <alain.bonnefoy@icbt.com> wrote:

I defined a :
EXTRA_TARGETS=pkg
to make my packages according to what I saw in recurse.mk line 67. (6.1)
When I execute make, it says that I override commands for target ‘pkg’. !?

Does this ‘pkg’ rule really exists? if yes what does it supposed to do?

Where exactly did you add the EXTRA_TARGETS line, and where exactly did
you add the definition of the ‘pkg’ rule?

BTW, the 6.2 recurse.mk doesn’t require you to define EXTRA_TARGETS
anymore - it’s smart enough to figure things out on its own.

Where are these mk files explained (rules, macros,…).

Appendix B of the Programmer’s Guide.


Brian Stecher (bstecher@qnx.com) QNX Software Systems, Ltd.
phone: +1 (613) 591-0931 (voice) 175 Terence Matthews Cr.
+1 (613) 591-3579 (fax) Kanata, Ontario, Canada K2M 1W8

Brian Stecher a écrit:

Alain Bonnefoy <> alain.bonnefoy@icbt.com> > wrote:


I defined a :
EXTRA_TARGETS=pkg
to make my packages according to what I saw in recurse.mk line 67. (6.1)
When I execute make, it says that I override commands for target ‘pkg’. !?





Does this ‘pkg’ rule really exists? if yes what does it supposed to do?



Where exactly did you add the EXTRA_TARGETS line, and where exactly did
you add the definition of the ‘pkg’ rule?


My topmost makefile is:


EARLY_DIRS=mc_inversion mc_sinus mc_triangle mc_multiramp
LATE_DIRS=mc_components

ifndef QRECURSE
QRECURSE=recurse.mk
ifdef QCONFIG
QRDIR=$(dir $(QCONFIG))
endif
endif

EXTRA_TARGETS=pkg

include $(QRDIR)$(QRECURSE)

subdirectories makefiles are:


EARLY_DIRS=mc_inversion_API
ifndef QRECURSE
QRECURSE=recurse.mk
ifdef QCONFIG
QRDIR=$(dir $(QCONFIG))
endif
endif

include $(QRDIR)$(QRECURSE)

pkg:
rm -f *.qpm *.qpk
packager -u

BTW, the 6.2 recurse.mk doesn’t require you to define EXTRA_TARGETS
anymore - it’s smart enough to figure things out on its own.




Where are these mk files explained (rules, macros,…).



Appendix B of the Programmer’s Guide.



I didn’t find a way to include pkg rule in the topmost makefile which

should be done AFTER all subdirectories pkg rules.
Any idea?

Thanks,
Alain.

Alain Bonnefoy <alain.bonnefoy@icbt.com> wrote:

subdirectories makefiles are:


EARLY_DIRS=mc_inversion_API
ifndef QRECURSE
QRECURSE=recurse.mk
ifdef QCONFIG
QRDIR=$(dir $(QCONFIG))
endif
endif

include $(QRDIR)$(QRECURSE)

pkg:
rm -f *.qpm *.qpk
packager -u

Ahh. There’s your problem.

You’re getting the redefinition because the recurse.mk is defining
a ‘pkg’ target because of your EXTRA_TARGETS definition and then
you define it again in the Makefile.

With the QNX makefiles (aside from the couple of macros defined
in a appendix B) you never, ever modify a recursing Makefile.
99.999999999999999999% of the time you never modify a variant
level Makefile (the one that includes the “common.mk”).

All the things that’d you normally add to a Makefile, you instead
add to the common.mk file. In this case you’d add:

pkg:
cd $(PROJECT_ROOT); rm -f *.qp[mk]; packager -u

after the include of qtargets.mk.

I didn’t find a way to include pkg rule in the topmost makefile which
should be done AFTER all subdirectories pkg rules.
Any idea?

I can’t see any way aside from doing two makes, the first to create
the executables and the second to do the packaging.


Brian Stecher (bstecher@qnx.com) QNX Software Systems, Ltd.
phone: +1 (613) 591-0931 (voice) 175 Terence Matthews Cr.
+1 (613) 591-3579 (fax) Kanata, Ontario, Canada K2M 1W8

Brian Stecher a écrit:

Alain Bonnefoy <> alain.bonnefoy@icbt.com> > wrote:


subdirectories makefiles are:




\

EARLY_DIRS=mc_inversion_API
ifndef QRECURSE
QRECURSE=recurse.mk
ifdef QCONFIG
QRDIR=$(dir $(QCONFIG))
endif
endif





include $(QRDIR)$(QRECURSE)





pkg:
rm -f *.qpm *.qpk
packager -u




Ahh. There’s your problem.

You’re getting the redefinition because the recurse.mk is defining
a ‘pkg’ target because of your EXTRA_TARGETS definition and then
you define it again in the Makefile.

With the QNX makefiles (aside from the couple of macros defined
in a appendix B) you never, ever modify a recursing Makefile.
99.999999999999999999% of the time you never modify a variant
level Makefile (the one that includes the “common.mk”).

All the things that’d you normally add to a Makefile, you instead
add to the common.mk file. In this case you’d add:

pkg:
cd $(PROJECT_ROOT); rm -f *.qp[mk]; packager -u

after the include of qtargets.mk.

But I cannot include these rules in my common.mk files, because my

common.mk are not at the right levels.

I need to precise what I’d like to do:

We develop a package collection belonging to one project, named
mc_components:

mc_components
|-…
|-Makefile <---- The one with EXTRA_TARGET definition
|-package.qpg
|-mc_components-x.z.qpr
|
|-mc_triangle
| |-Makefile <------ The one with pkg: rm *.qp[mk]; packager -u
| |-package.qpg
| |-mc_triange-x.x.qp[mk]
| |
| |-mc_triangle
| | |-common.mk
| | |-Makefile
| | |-nto/x86/o
| |
| |-mc_triangle_API
| | |-common.mk
| | |-Makefile
| | |-nto/x86/so
| |
| |-mc_triangle_ctrl
| | |-common.mk
| | |-Makefile
| | |-nto/x86/o
|
|-mc_sinus
| |-Makefile <------ The one with pkg: rm *.qp[mk]; packager -u
| |-package.qpg
| |-mc_sinus-x.x.qp[mk]
| |
| |-mc_sinus
| | |-common.mk
| | |-Makefile
| | |-nto/x86/o
| |
| |-mc_sinus_API
| | |-common.mk
| | |-Makefile
| | |-nto/x86/so
| |
| |-mc_sinus_ctrl
| | |-common.mk
| | |-Makefile
| | |-nto/x86/o
|
.
.

So, I’d like that mc_components be ‘super package’, containing several
packages.

According to my tests, if I want that ‘make pkg’ started at
mc_components level, do all my packages, I need my EXTRA_TARGET=pkg
definition, to be recursive,
And, if I want to explain what to do on ‘make pkg’, I think that I need
the ‘pkg: rm…’ rules int the subdirectories Makefile.
No ?

Actually, all my packages are done as I want, I just have a problem to
make the mc_components.x.z.qpr because it must be done after all others.

I didn’t find a way to include pkg rule in the topmost makefile which
should be done AFTER all subdirectories pkg rules.
Any idea?



I can’t see any way aside from doing two makes, the first to create
the executables and the second to do the packaging.



But, it’s exactly as to make; make install ? I just want to make; make

pkg. What’s more logical on QNX?

I think I need something like a POST_INSTALL macros.

Regards,
Alain.

Alain Bonnefoy <alain.bonnefoy@icbt.com> wrote:

Brian Stecher wrote:

pkg:
cd $(PROJECT_ROOT); rm -f *.qp[mk]; packager -u

after the include of qtargets.mk.

But I cannot include these rules in my common.mk files, because my
common.mk are not at the right levels.

That’s what the cd $(PROJECT_ROOT) does - bump you up to the right
place.

The design of the makefiles were that the only job of the interior Makefile’s
were to get you down to the bottom level variant directories. All the
real action happens down there.

I can’t see any way aside from doing two makes, the first to create
the executables and the second to do the packaging.

But, it’s exactly as to make; make install ? I just want to make; make
pkg. What’s more logical on QNX?

I think I need something like a POST_INSTALL macros.

Won’t work - the POST_INSTALL’s get done too soon for you. You need
to wait until all the building is done before you can package. That’s
why I said that you need to do it with two makes - the first to
build and the second to package. The way we do it here is that
we don’t bother with a “make pkg” - the packaging step is done
with a simple (well, not so simple in our case :slight_smile: shell script.

\

Brian Stecher (bstecher@qnx.com) QNX Software Systems, Ltd.
phone: +1 (613) 591-0931 (voice) 175 Terence Matthews Cr.
+1 (613) 591-3579 (fax) Kanata, Ontario, Canada K2M 1W8

So,
I tried to include an EXTRA_TARGET=pkg in my topmost Makefile and the
pkg rule in a common.mk:

mc_components
|-…
|-Makefile <---- The one with EXTRA_TARGET=pkg definition
|-package.qpg
|-mc_components-x.z.qpr
|
|-mc_triangle
| |-Makefile
| |-package.qpg
| |-mc_triange-x.x.qp[mk]
| |
| |-mc_triangle
| | |-common.mk <------ The one with pkg: cd $(PROJECT_ROOT);
rm *.qp[mk]; packager -u
| | |-Makefile
| | |-nto/x86/o
| |
| |-mc_triangle_API
| | |-common.mk
| | |-Makefile
| | |-nto/x86/so
| |
| |-mc_triangle_ctrl
| | |-common.mk
| | |-Makefile
| | |-nto/x86/o
|
|-mc_sinus
| |
. .
. .


No warning anymore but the only result I get is:

make -j 1 -Cmc_inversion pkg && make -j 1 -Cmc_multiramp pkg && make -j
1 -Cmc_sinus pkg && make -j 1 -Cmc_triangle pkg && make -j 1
-Cmc_placement pkg && make -j 1 -Cmc_template pkg
make[1]: Entering directory
/home/a.bonnefoy/src/mc_components/mc_inversion' make -j 1 -Cmc_inversion_API pkg && make -j 1 -Cmc_inversion pkg && make -j 1 -Cmc_inversion_ctrl pkg makemake[2]: Entering directory /home/a.bonnefoy/src/mc_components/mc_inversion/mc_inversion_API’
make -j 1 -Cnto pkg
make[3]: Entering directory
/home/a.bonnefoy/src/mc_components/mc_inversion/mc_inversion_API/nto' make -j 1 -Cx86 pkg make[4]: Entering directory /home/a.bonnefoy/src/mc_components/mc_inversion/mc_inversion_API/nto/x86’
make -j 1 -Cso pkg && make -j 1 -Cso.g pkg
make[5]: Entering directory
/home/a.bonnefoy/src/mc_components/mc_inversion/mc_inversion_API/nto/x86/so' make[5]: Leaving directory /home/a.bonnefoy/src/mc_components/mc_inversion/mc_inversion_API/nto/x86/so’
make[4]: Leaving directory
/home/a.bonnefoy/src/mc_components/mc_inversion/mc_inversion_API/nto/x86' make[3]: Leaving directory /home/a.bonnefoy/src/mc_components/mc_inversion/mc_inversion_API/nto’
make[2]: Leaving directory
/home/a.bonnefoy/src/mc_components/mc_inversion/mc_inversion_API' make[1]: Leaving directory /home/a.bonnefoy/src/mc_components/mc_inversion’
make[5]: *** No rule to make target `pkg’. Stop.
make[4]: *** [pkg] Error 2
make[3]: *** [pkg] Error 2
make[2]: *** [pkg] Error 2
make[1]: *** [pkg] Error 2
make: *** [pkg] Error 2

Brian Stecher a écrit:

Alain Bonnefoy <> alain.bonnefoy@icbt.com> > wrote:


Brian Stecher wrote:





pkg:
cd $(PROJECT_ROOT); rm -f *.qp[mk]; packager -u

after the include of qtargets.mk.



But I cannot include these rules in my common.mk files, because my
common.mk are not at the right levels.



That’s what the cd $(PROJECT_ROOT) does - bump you up to the right
place.

The design of the makefiles were that the only job of the interior Makefile’s
were to get you down to the bottom level variant directories. All the
real action happens down there.



I can’t see any way aside from doing two makes, the first to create
the executables and the second to do the packaging.



But, it’s exactly as to make; make install ? I just want to make; make
pkg. What’s more logical on QNX?

I think I need something like a POST_INSTALL macros.



Won’t work - the POST_INSTALL’s get done too soon for you. You need
to wait until all the building is done before you can package. That’s
why I said that you need to do it with two makes - the first to
build and the second to package. The way we do it here is that
we don’t bother with a “make pkg” - the packaging step is done
with a simple (well, not so simple in our case > :slight_smile: > shell script.
\