[Top][All Lists]

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

Re: using pswrap

From: Tom Tromey
Subject: Re: using pswrap
Date: 21 Jan 2001 19:02:05 -0700

>>>>> "trevor" == trevor  <address@hidden> writes:

trevor> one of the first steps that must take place in order to
trevor> compile is to apply a function called "pswrap" to the "*.psw"
trevor> file to generate both a *.h and a *.c file; much the same as
trevor> using LEX and YACC.

trevor> the "" that i came up with for the "code" folder looks like 
trevor> this:

trevor> ----------------------------------------------------------------
trevor> SUFFIXES = .psw .h

trevor> noinst_PROGRAMS = example
trevor> example_SOURCES = example.c wraps.c
trevor> example_DEPENDENCIES = wraps.h wraps.c
trevor> EXTRA_DIST = wraps.psw
trevor> example_LDADD = $(X_LIBS) $(X_PRE_LIBS) -lX11 $(X_EXTRA_LIBS)

trevor> INCLUDES = $(X_CFLAGS)

trevor> .psw.c:
trevor>         pswrap -a -o address@hidden $<

trevor> .psw.h:
trevor>         pswrap -a -h address@hidden $< &> /dev/null

Using `&>' here isn't portable.  Use `> /dev/null 2>&1' instead.

trevor> 1) is this okay? is this a decent file to
trevor> accomplish that which i am trying to do?


trevor> 2) when i do the "make" it compiles perfectly fine and
trevor> everything is nice. but i noticed that although i've clearly
trevor> specified that both "wraps.h" and "wraps.c" are prerequisites
trevor> for "example", only "wraps.h" gets created before "example.c"
trevor> gets "gcc -c". this isn't a problem since everything works out
trevor> well enough since at this stage it's doing a compile only. i'm
trevor> just wondering why i get this behaviour.

Probably because of how make decides to construct the dependency tree.

Adding `BUILT_SOURCES = wraps.h wraps.c' might help.

trevor> 3) it's a bit of a lie to say that "wraps.c" is a source,
trevor> since it doesn't exist until the "pswrap" utility is
trevor> executed. but if i don't specify it this way then when the
trevor> final link is performed it won't link in "wraps.o" in with
trevor> "example.o" to create "example". is there a better way to do
trevor> this?

You could try just putting `wraps.psw' into example_SOURCES.  This
might work.

Or you could fool around with example_LDADD, but that is probably more
painful than what you're presently doing.

trevor> 4) when i do a "make dist", a "wraps.c" file gets included in
trevor> the distribution (even if i explicitly delete it before the
trevor> "make dist"), i assume this is because of the
trevor> "example_SOURCES" line including "wraps.c". i don't want to
trevor> include my "wraps.c" since different platforms might create
trevor> this file differently. any ideas how i can do this (i guess
trevor> this is probably still more of the same with regards to my
trevor> previous point (3))?

Remove wraps.c and wraps.h from the distribution in a dist-hook.
This is probably documented; if not please tell me and I'll fix it.

trevor> 5) i would like to create a "clean::" target that would $(RM)
trevor> the "wraps.[ch]" files, but "make" complains that the
trevor> "Makefile" contains both "clean:" and "clean::" targets. how
trevor> to i add my own "clean" targets?

This is documented.  Use CLEANFILES.

You can't add a "::" rule that conflicts with an automake-generated

trevor> 6) i think it would be nicer to modularize this (much the same
trevor> as with LEX and YACC) how would i go about this? should i
trevor> create my own *.m4 file with the necessary scripts? i'm not an
trevor> autotools expert but i think having a "example_WRAPS =
trevor> wraps.psw" line would be nice.

More in the automake style would be to put the .psw files into
_SOURCES.  This might work already (in the context of your; I forget.


reply via email to

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