automake
[Top][All Lists]
Advanced

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

Re: Automake with Pro*C


From: Ralf Wildenhues
Subject: Re: Automake with Pro*C
Date: Sun, 31 Aug 2008 05:34:03 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hello Sebastien,

please do not top-post, thank you.

* Sebastien REYNES wrote on Fri, Aug 29, 2008 at 09:37:43AM CEST:
> 
> lib_LIBRARIES = libcompc.a
> libcompc_a_SOURCES = ate_u0002.pc ate_u0008.pc ate_u0009.pc ate_u0100.pc
> INCLUDES = -I$(ORACLE_HOME)/precomp/public -I/usr/include

FWIW, I would not hard-code -I/usr/include into a Makefile.am: you don't
know whether your users even want that to come early, also it's searched
by default so you don't need that unless you need it to come earlier.

More generally, it's better style not to set INCLUDES in Makefile.am at
all, but rather let AM_CPPFLAGS be adjusted from configure tests.

> SUFFIXES = .o .c .pc
> .pc.c:
>         $(ORACLE_HOME)/bin/proc -DANSI_PRO_C mode=ansi code=ansi_c lines=yes
> iname=$<
> .c.o:
>         $(CC) -c $<

This rule overrides a useful rule which automake will generate for you,
and contain all of the nice other variables like CFLAGS, CPPFLAGS, and
so on.  Also, you don't really need the SUFFIXES setting.

I suggest you do it like this instead:

lib_LIBRARIES = libcompc.a
pcfiles = ate_u0002.pc ate_u0008.pc ate_u0009.pc ate_u0100.pc
EXTRA_DIST = $(pcfiles)
nodist_libcompc_a_SOURCES = $(pcfiles:.pc=.c)
PCC = $(ORACLE_HOME)/bin/proc
PCCFLAGS = -DANSI_PRO_C mode=ansi code=ansi_c lines=yes
.pc.c:
        $(PCC) $(PCCFLAGS) iname=$<


That way, things will still work if you use per-target flags for the
library (e.g., libcompc_a_CFLAGS) later.  Please note that the
nodist_*SOURCES mean that the .c files are not put in the tarball with
'make dist'.  If you prefer to have them distributed, so that, say, your
users don't need to have proc installed (I don't know if its output is
system-dependent or not), then you should omit the nodist_ prefix.

> These commands allow to create a static library from Pro*C files. I have now
> to link the library to create the executables using it.

Like:

bin_PROGRAMS = foo bar
foo_LDADD = libcomp.a
bar_LDADD = libcomp.a

Cheers,
Ralf




reply via email to

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