Improvements
[infodrom.org/oldenburg.linux.de] / src / Makefile
1 WML_FILES = $(wildcard *.wml)
2 FILES = $(WML_FILES:%.wml=%.html)
3
4 #DIRS = Termine News Infos Service
5 DIRS = $(shell find . -maxdepth 1 -type d -not -name . -not -name CVS)
6
7 #ROOT_PREFIX = $(shell perl -MCwd -e '$d = cwd;$d =~ s/^.*src\/?(.*)$/$1/;@f=split (/\//, $d);print "../"x($#f+1);')
8 ROOT_PREFIX = $(shell perl -MCwd -e '$$_ = cwd;s/^.*src\/?//;@f=split /\//;$$n=$$\#f+1;print "../"x $$n;' )
9 #ROOT_PREFIX = $(shell perl -MCwd -e '$d = cwd();')
10 #ROOT_PREFIX = $(shell echo "foo" 'bar \(\)')
11
12 ifeq ($(TERM),dumb)
13 WML = /usr/bin/wml -n -q
14 else
15 WML = /usr/bin/wml -n
16 endif
17
18 MLOCAL = $(wildcard Makefile.local)
19
20 IFLAGS = -I. -I$(ROOT_PREFIX)../Styles
21
22 .SUFFIXES: .wml .html
23
24 #       ${CC} ${CFLAGS} -c $*.c
25 # .c.i:
26 #       $(RM) $@@
27 #       $(CC) -E $(CFLAGS) $(_NOOP_) $*.c > $@@
28
29 .wml.html:
30         $(WML) $(IFLAGS) -o $*.html $*.wml
31 #       /usr/bin/wml -n $(IFLAGS) $*.wml| sed 's:"[a-zA-Z0-9_]*\.imgdot-1x1-transp\.gif":"../pix/imgdot-1x1-transp.gif":' > $*.html
32         $(ROOT_PREFIX)../bin/fixsuffix $*.html
33
34 all: $(FILES)
35         test -z "$(DIRS)" || for d in "" $(DIRS); do if [ -n "$$d" ]; then (cp Makefile $$d && cd $$d && make all); fi; done
36
37 clean:
38         rm -f $(FILES) *.imgdot-1x1-transp.gif .depend
39         test -z "$(DIRS)" || for d in "" $(DIRS); do if [ -n "$$d" ]; then (cp Makefile $$d && cd $$d && make clean); fi; done
40         test -z "$(ROOT_PREFIX)" || rm -f Makefile
41
42 install:
43         cd $(ROOT_PREFIX).. && make install
44
45 test:
46         cd $(ROOT_PREFIX).. && make test
47
48 depend .depend:
49         $(ROOT_PREFIX)../bin/wmldepend.sh $(IFLAGS) $(WML_FILES) > .depend
50
51 include .depend
52
53 ifneq "$(MLOCAL)" ""
54 include Makefile.local
55 endif