automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Automake 1.7.2 & using implicit rules PART2


From: Sander Niemeijer
Subject: Re: Automake 1.7.2 & using implicit rules PART2
Date: Thu, 17 Apr 2003 14:13:02 +0200

Hi Juraj,

I'm afraid you will have to specify the outputs of that are generated by tao_idl. The first reason is that (as far as i know) you can't tell automake to include generated objects that have a different stem (= filename - suffix) then the source file has. i.e. myfile.g should generate a myfile.o (and make of course doesn't know how to create this from a myfileC.cpp file) The second reason is that you are generating .h files which will pose dependency problems when you are trying to include them in other sources (if these sources are compiled before the .idl files got compiled you will get 'can't find header inputC.h' kind of errors). In order to circumvent these dependency problems you will have to add all your generated header files to the BUILT_SOURCES variable.
The approach I would take would be as follows:

---
SUFFIXES = .idl C.h C.cpp S.h S.cpp S_T.h S_T.cpp

IDLFILES = input.idl
IDLGENSOURCES = inputC.cpp inputS.cpp inputS_T.cpp
IDLGENHEADERS = inputC.h inputS.h inputS_T.h

DUMMYTAO = touch $(IDLGENSOURCES) $(IDLGENHEADERS)

BUILT_SOURCES = $(IDLGENHEADERS)
EXTRA_DIST = $(IDLFILES)
CLEANFILES = $(IDLGENSOURCES) $(IDLGENHEADERS)

.idlC.h:
        $(DUMMYTAO)
.idlC.cpp:
        $(DUMMYTAO)
.idlS.h:
        $(DUMMYTAO)
.idlS.cpp:
        $(DUMMYTAO)
.idlS_T.h:
        $(DUMMYTAO)
.idlS_T.cpp:
        $(DUMMYTAO)

bin_PROGRAMS = foo

foo_SOURCES = main.cpp
nodist_foo_SOURCES = $(IDLGENSOURCES) $(IDLGENHEADERS)
---

Hope this helps.

Regards,
Sander

On donderdag, apr 17, 2003, at 12:03 Europe/Amsterdam, Juraj Hercek wrote:

Hi,

Problem I had was that I was specifying %s in Makefile (sort of shortcut for patsubst function). It seems automake doesn't accept this notation, so using $(VARIABLE:%.g=%.cpp) won't work as well as implicit rules using %s. However, if we use old style (i.e. $(VARIABLE:.g=.cpp) and ".g.cpp" like rules, it works.

I tried to make an example, but I made it even more unclear. I've specified also lxx file in previous example so I know whether transition from .g to .o through lex works.

The real application  is tao_idl, which takes some idl file as an input and produces nine ouptut files.

Example:
Let's say we have  file input.idl.  Produced files will be then (after running tao_idl input.idl):
inputC.h
inputC.cpp
inputC.i
inputS.h
inputS.cpp
inputS.i
inputS_T.h
inputS_T.cpp
inputS_T.i

What do I want is to specify only idl files in program_SOURCES variables and specify implicit rules so all cpp files are build (i.e. *C.cpp, *S.cpp, *S_T.cpp). I'm not sure this is possible. Because I'm not sure whether there is a way how to tell automake that we want to build three cpp files from one idl file using implicit rules.

Next I bumped into this problem...
I tested this and couldn't get expected output (am_amktest_OBJECTS in Makefile.in is still empty):

---Makefile.am---
AUTOMAKE_OPTIONS = foreign

SUFFIXES = .g C.cpp

.gC.cpp:
    @echo "Ok, it works"
    touch $@

bin_PROGRAMS= amktest

amktest_SOURCES= myfile.g---
#---EOF---
---configure.ac---
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.57)
AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
AM_INIT_AUTOMAKE

AC_CONFIG_SRCDIR([myfile.g])
AC_CONFIG_HEADER([config.h])

# Checks for programs.
AC_PROG_CXX

# Checks for libraries.

# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.

AC_CONFIG_FILES(Makefile)
AC_OUTPUT
#---EOF---

After doing:
$ aclocal &&  autoheader && autoconf && automake -a && touch myfile.g && ./configure && make

I'm still getting:
make  all-am
make[1]: Entering directory `/tmp/00'
cc     -o amktest   
gcc-3.2.2: no input files
make[1]: *** [amktest] Error 1
make[1]: Leaving directory `/tmp/00'
make: *** [all] Error 2

Then running this to see am_amktest_OBJECTS...
$ cat Makefile.in | grep "am_amktest_OBJECTS"
am_amktest_OBJECTS =
amktest_OBJECTS = $(am_amktest_OBJECTS)

Automake doesn't accept my SUFFIXES... Probably.

It seems I'm still missing some detail, which causes me troubles (before, I would swear that also implicit rules without %s didn't  worked when I've had tried them...). Maybe some automatically generated files that aren't regenerated (but used during Makefile.in building) after I do "automake && ./configure" or whatever mess in...

Thanks for help.

Regards,
Juraj


Sander Niemeijer wrote:

Hi,

I have some problems understanding what will be created from a  source.src file by filemaker (I myself am not familiar with this  application). You can use suffix rules but these only work when the filename bit  without the suffix part is the same for both the source and target  files. This means that if you have something like:
---
SUFFIXES = .src
.c.src:
    filemaker $<
bin_PROGRAMS = foo
foo_SOURCES = foo.src
---
automake will expect filemaker to create a foo.c.
So my question back to you is: what exactly is created from a foo.src  file (all three .cpp, .c, and .lxx files or only one of them) and what  will be the exact file names for the generated files (foo.cpp, foo.c,  and foo.lxx or different)?


Regards,
Sander






reply via email to

[Prev in Thread] Current Thread [Next in Thread]