Re: 2 Fragen zu Makefiles

2002-03-20 Diskussionsfäden Joerg Jaspert

Jonas Meurer [EMAIL PROTECTED] writes:

 Nun wäre es mir aber wesentlich lieber wenn ich nicht jedes neue
 .wml-file dort eintragen müsste, und statt dessen make alle .wml-files
 selber findet. Also nach dem Motto:
 HTMLS = (code dass alle .wml-files hier stehen, am besten ohne .wml)
 Geht das irgendwie?
 Dann würde ich für jedes subdir dieses Makefile verwenden, und hieraus
 entspringt meine 2. Frage:
 Geht das auch mit directories?

Ich geb keine Garantie ob ich alles wichtige rausgefischt habe, aber
das hier steht im Emacs Makefile (lisp-dir). Und sieht eigentlich nach
dem aus was du willst. Evtl. auch einfach Overkill, aber siehs dir an. :)

-++
SHELL = /bin/sh

lisp=/develop/Emacs/Emacs/emacs/lisp
VPATH=/develop/Emacs/Emacs/emacs/lisp
srcdir=/develop/Emacs/Emacs/emacs/lisp/..

# Common command to find subdirectories

setwins=subdirs=`find $$wd -type d -print`; \
for file in $$subdirs; do \
   case $$file in */Old | */RCS | */CVS | */CVS/* | */=* ) ;; \
*) wins=$$wins $$file ;; \
   esac; \
done

finder_setwins=subdirs=`find $$wd -type d -print`; \
for file in $$subdirs; do \
   case $$file in */Old | */RCS | */CVS | */CVS/* | */=* | */obsolete | */term 
) ;; \
*) wins=$$wins $$file ;; \
   esac; \
done

subdirs.el:
$(MAKE) $(MFLAGS) update-subdirs
update-subdirs: doit
wd=$(lisp); $(setwins); \
for file in $$wins; do \
   $(srcdir)/update-subdirs $$file; \
done;

.SUFFIXES: .elc .el

.el.elc: subdirs.el
-$(emacs) -f batch-byte-compile $

# Compile all Lisp files, except those from DONTCOMPILE,
# but don't recompile those that are up to date.

# All .elc files are made writable
# before compilation in case we checked out read-only (CVS option -r).
# Files MUST be compiled one by one.  If we compile several files in a
# row we can't make sure that the compilation environment is clean.
# We also set the load-path of the Emacs used for compilation to the
# current directory and its subdirectories, to make sure require's and
# load's in the files being compiled find the right files.

compile: subdirs.el doit
find $(lisp) -name *.elc -print | xargs chmod +w /dev/null 21; \
wd=$(lisp); $(setwins); \
elpat=`echo $$wins | tr '   ' '\012\012' | \
sed -e 's|\(.\)$$|\1/|' -e 's|^\./||' -e 's|$$|*.el|'`; \
els=`echo $$elpat $(DONTCOMPILE) $(COMPILE_FIRST) | \
tr ' ' '\012\012' | sort | uniq -u`; \
for el in $(COMPILE_FIRST) $$els; do \
  echo Compiling $$el; \
  $(emacs) -f batch-byte-compile-if-not-done $$el || exit 1; \
done

# Compile all Lisp files, except those from DONTCOMPILE.  This
# is like `compile' but compiles files unconditionally.
compile-always: subdirs.el doit
find $(lisp) -name *.elc -print | xargs chmod +w /dev/null 21; \
wd=$(lisp); $(setwins); \
elpat=`echo $$wins | tr '   ' '\012\012' | \
sed -e 's|\(.\)$$|\1/|' -e 's|^\./||' -e 's|$$|*.el|'`; \
els=`echo $$elpat $(DONTCOMPILE) $(COMPILE_FIRST) | \
tr ' ' '\012\012' | sort | uniq -u`; \
for el in $(COMPILE_FIRST) $$els; do \
  echo Compiling $$el; \
  $(emacs) -f batch-byte-compile $$el || exit 1; \
done
++-

Wenn Du willst send ich dir auch das ganze, falls ich da was vergessen
haben sollte. Ausser latürnich du hast den Emacs Source :)

-- 
begin  OjE-ist-scheisse.txt
bye, Joerg
Registered Linux User #97793 @ http://counter.li.org
end


-- 
Zum AUSTRAGEN schicken Sie eine Mail an [EMAIL PROTECTED]
mit dem Subject unsubscribe. Probleme? Mail an [EMAIL PROTECTED] (engl)




Re: 2 Fragen zu Makefiles

2002-03-20 Diskussionsfäden Karl-Heinz Köther

Am Dienstag, 19. März 2002 22:45 schrieb Jonas Meurer:
 Ich habe ein Verzeichnis, wo .wml-files und Subdirs mit .wml-files
 drinnen sind. Bisher habe ich das immer so gemacht:
 [...]
 Nun wäre es mir aber wesentlich lieber wenn ich nicht jedes neue
 .wml-file dort eintragen müsste, und statt dessen make alle .wml-files
 selber findet. Also nach dem Motto:
 HTMLS = (code dass alle .wml-files hier stehen, am besten ohne .wml)

Hi Jonas,

das Makefile soll die Abhängigkeiten zwischen wml-Dateien und html-Dateien 
beschreiben, dazu wird das Suffix benutzt:

all: eins.html zwei.html

.SUFFIXES: .html .wml

 ##$@ : html
 ##$ : wml
.wml.html:
${WML} ${FLAGS} $@ $

eins.html: datei1.include datei2.include
zwei.html: ...

und auch nur die im Makefile genannten Dateien compilieren ... 


Auf Unterverzeichnisse verweise ich nicht - da ich sonst auf ein echtes 
Feature von wml verzichte: Substitution von Variablen
Datei: .wmlrc
-D VARIABLE=zeichenkette
# die Variable hat in jedem Verzeichnis den gleichen Wert
-D SITEHOME~.
# die Variable berücksichtigt das Verzeichnis
# im aktuellen Verzeichnis: .
# in einem SubDir: ./subdir

Der Wert der Variablen ist abhängig vom Verzeichnis in dem der Compiler wml 
gestartet wird - nicht das Verzeichnis in dem der wml-Code steht.

Drum habe ich mir ein Perl-Script geschrieben - das rekursiv vom 
Startverzeichnis aus in alle Unterverzeichnisse mit einer Datei Makefile 
wechselt und das Makefile _dort_ ausführt ;-)

bye, karl-heinz.
-- 
Twinkle twinkle little star, how I wonder what you are?
Up above the world so high, like a diamond in the sky.


-- 
Zum AUSTRAGEN schicken Sie eine Mail an [EMAIL PROTECTED]
mit dem Subject unsubscribe. Probleme? Mail an [EMAIL PROTECTED] (engl)