[Top][All Lists]

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

using pswrap

From: trevor
Subject: using pswrap
Date: Fri, 19 Jan 2001 09:36:59 -0500

hi everyone,

i've started playing around with the DPS library that comes with 
XFree86 (as well as other X servers). up to now i've been creating 
Makefiles by hand but i have used the autotools, i just am not sure how 
to apply them to this type of project. your help would be most 

i created a very simple project that demonstrates what i'd like to do. 
the project's root folder contains nothing more than the "" 
and "" files. there is one subfolder called "code" which 
contains a "", the source file "example.c", and a wrap 
called "wraps.psw".

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

the "" that i came up with for the "code" folder looks like 

SUFFIXES = .psw .h

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


        pswrap -a -o address@hidden $<

        pswrap -a -h address@hidden $< &> /dev/null

this works and gets the job done but there are some things i'd like to 
ask about it.

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

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

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

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

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

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

i look forward to your observations.

best regards,

ps. please CC me if you reply

reply via email to

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