[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Parsing Makefile.am and configure.in
From: |
Masatake YAMATO |
Subject: |
Re: Parsing Makefile.am and configure.in |
Date: |
Fri, 07 Dec 2001 21:53:23 +0900 (JST) |
> I'm new to the list - so please excuse me if this has already been
> discussed.
>
> Is there any available library which parses Makefile.am/configure.in
> recursively and generates a single consolidated project structure
> (either as an XML file for as an in-memory data structure) for
> reading/writing ?
Interesting.
I tried same thing in my small project named "pm", when I tried rpm
and deb targets to Makefile.in generated by automake.
Now autopack subproject is started therefore I aborted my "pm".
The idea is "Don't write a parser, don't write perl scripts".
You can get the infomation in Makefile.am without parser.
Put "GNUMakefile" into project root directory.
I've put "GNUMakefile" at the end of this file.
then run
make -s -f GNUMakefile echo-includes
You'll get header file paths referred from the project.
e.g. (gtk+-1.2.9)
$ make -s -f GNUMakefile echo-includes
(includes :subdir po ".." "../intl" :subdir gdk
".." "/usr/include/glib-1.2" "/usr/lib/glib/include"
"/usr/X11R6/include" :subdir gtk ".." "/usr/include/glib-1.2"
"/usr/lib/glib/include" "/usr/X11R6/include" :subdir docs )
Of course, you can change lisp style to XML.
### GNUMakefile
### Author: Masatake YAMATO
### Use this program under the term of GNU GPL.
include Makefile
# Install myself recursively
install-wrapper:
@if test "x$(SUBDIRS)" != x ; then \
for x in $(SUBDIRS); do \
cp ${top_srcdir}/autox.mak $$x/wrapper.mak; \
(cd $$x; make -f wrapper.mak install-wrapper);\
done; \
fi
# Getting project directories
echo-subdirs: install-wrapper
@echo -n "(subdirs "
@for x in $(SUBDIRS); do \
echo -n "\"`pwd`/$$x\" "; \
(cd $$x; make -f wrapper.mak echo-subdirs0); \
done
@echo -n \)
echo-subdirs0:
@for x in $(SUBDIRS); do \
echo -n "\"`pwd`/$$x\" "; \
(cd $$x; make -f wrapper.mak echo-subdirs0); \
done
# Geting -I dirs
echo-includes: install-wrapper
@echo -n "(includes "
@for x in $(INCLUDES); do \
x=`echo $$x | grep -e -I`;\
if test x$$x != x ; then \
echo -n \"`echo $$x | sed s/-I//`\"; \
echo -n " "; \
fi ; \
done ;
@for x in $(SUBDIRS); do \
echo -n :subdir $$x " "; \
(cd $$x; make -f wrapper.mak echo-includes0); \
done
@echo -n \)
echo-includes0:
@for x in $(INCLUDES); do \
x=`echo $$x | grep -e -I`;\
if test x$$x != x ; then \
echo -n \"`echo $$x | sed s/-I//`\"; \
echo -n " "; \
fi ; \
done