[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Need Code to Run Before Targets Are Processed?
From: |
Ineiev |
Subject: |
Re: Need Code to Run Before Targets Are Processed? |
Date: |
Fri, 1 Aug 2008 10:33:00 +0400 |
Hello, Bobby
On 8/1/08, Bobby Dill <address@hidden> wrote:
> # This code must be run before anything is compiled
> forms="mainform \
> colorname \
> findform \
> optionsform"
>
> uicode := $(foreach i, $(forms), $(i).ui.h)
> mocced := $(foreach i, $(forms), moc_$(i).cpp)
> uicgen := $(foreach i, $(forms), $(i).h $(i).cpp)
>
> %foreach i in $(forms)
> $(i).h: $(i).ui
> $(i).cpp: $(i).ui $(i).h
> %end
> # End section
When I needed something like this, I wrote an m4 template for Makefile.am
(file named Makefile.am.m4). it looked like this:
define(MYPROJECT_FORM,
`
##expanded form "$1" begins
uicode+= $1.h
mocced+= $1.cpp
uicgen+= $1.h $1.cpp
$1.h: $1.ui
$1.cpp: $1.ui $1.h
##expanded form "$1" ends
')
MYPROJECT_FORM(`mainform')
MYPROJECT_FORM(`colorname')
#and so on for every form
#to initially generate Makefile.am, issue this command manually:
Makefile.am: Makefile.am.m4
m4 $(srcdir)/Makefile.am.m4 > $(srcdir)/Makefile.am
I don't know if there is a better solution.
> # Create an image collection from all the images in the images directory
> images.cpp: $(wildcard images/*)
> uic -embed colortool $^ -o $@
Automake does not support wildcards (I believe this means that such
code may break some make targets like distcheck). They argue this
issue in Automake info, section FAQ->wildcards. The summary of their
considerations is that you should know your sources to keep them neat
and that it is technically hard to provide this feature portably.
Regards,
Ineiev
--
Navigare necesse est. Vivere non est necesse.
- Re: Need Code to Run Before Targets Are Processed?,
Ineiev <=