summaryrefslogtreecommitdiff
path: root/darwin/Makefile
blob: bd595967a14c977590b8998167b15a3d6eed4a98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
##
##	$Id$
##
##	Makefile for itools/darwin.lib
##	

CPP=		cpp
QUIETMAKE=	$(MAKE) -s
PHPCOMPILE=	/usr/local/bin/phpcompile

MODULE=		darwin
SUBDIRS=	
CLASSES=	query.class

#
# Library creation rules, do not change stuff below...
#
SLIB=		$(MODULE).slib
LIB=		../$(MODULE).lib

all:		$(LIB)

$(LIB):		$(SLIB)
		@if [ -x $(PHPCOMPILE) ]; then (echo Compiling $(SLIB) to $(LIB) ...) 1>&2; $(PHPCOMPILE) <$(SLIB) >$(LIB); else (echo $(PHPCOMPILE) not found, copying $(SLIB) to $(LIB) ...) 1>&2; cp $(SLIB) $(LIB); fi

$(SLIB):	$(CLASSES) DUMMY
		@(echo Creating $(SLIB) from $(SUBDIRS) $(CLASSES) ...) 1>&2
		@echo "<?php" >$(SLIB)
		@(for dir in DUMMY $(SUBDIRS); do (test -d $$dir && cd $$dir && $(QUIETMAKE) cat); done; for class in DUMMY $(CLASSES); do test -f $$class && cat $$class; done) | $(CPP) -P -undef | perl -ne 's/^\s+//g; print unless /^\s*$$/' | grep -v "^<?php" | grep -v "^?>" >>$(SLIB)
		@echo "?>" >>$(SLIB)

$(SUBDIRS)::
		@(cd $@; $(QUIETMAKE))

DUMMY:	

cat:		$(SLIB)
		@cat $(SLIB)

clean:		
		@(echo Cleaning $(SLIB) $(LIB) ...) 1>&2
		@rm -f $(SLIB) $(LIB)
		@for dir in DUMMY $(SUBDIRS); do (test -d $$dir && cd $$dir && $(QUIETMAKE) $@) || :; done