~eda-qa/dhlib/main

1 by edA-qa mort-ora-y
first
1
## Use mindepth 2 to exlclude this file in the packaged version
2
ALLMK=${shell find . -mindepth 2 -name "makefile"}
3
ALLDOC=${shell find doc -name "makefile"}
4
SUBMAKE=${MAKE}  -I ${abspath .} DHLIB_ROOT=${abspath .}
5
6
## all will do all makefile "all" targets in all subdirectories
7
all: SUBTARGET=all
8
all: $(ALLMK) swftest
9
10
.PHONY: help
11
help:
12
	@echo -e \
13
		all: Build all targets \\n\
14
		test: Run all tests \\n\
15
		swftest: Build HTML SWF test page \\n\
16
		doc: Build documentation \\n\
17
		distrib-package: Distribution package \\n\
18
		distrib-haxelib: haxelib distributions \\n\
19
	
20
## test will do all makefile "test" targets in all subdirectories
21
## These are assumed to be command-line tests which have a 
22
## success or fail return value
23
.PHONY: test
24
test: SUBTARGET=test 
25
test: EXTRAFLAGS=--silent --no-print-directory
26
test: $(ALLMK) 
27
28
## Test will do all makefile "doc" targets
29
.PHONY: doc
30
doc: SUBTARGET=doc
31
doc: EXTRAFLAGS=--silent --no-print-directory
32
doc: $(ALLDOC)
33
34
.PHONY: $(ALLMK)
35
$(ALLMK):
36
	@$(SUBMAKE) $(EXTRAFLAGS) -C ${dir $@} $(SUBTARGET)
37
	
38
swftest: swftestleft.html
39
swftestleft.html: create_swfindex.sh ${shell find . -name "*.swf"}
40
	./create_swfindex.sh
41
42
## subtarget can be used to build a specific target in a given makefile
43
## HDIR=directory containing makefile
44
## HTARGET=target in that file to execute
45
## This expects that make will be executed in the directory of this file
46
subtarget: 
47
	$(SUBMAKE) -C ${HDIR} ${HTARGET}
48
49
CLEAN=rm -f `find -name "*~"` && \
50
		rm -fr `find -name ".svn"` && \
51
		rm -fr restricted && \
52
		rm -f remove_license_from.sh
53
PNAME=dhlib
54
PDIR=../$(PNAME)
55
THISFILE=$(lastword $(MAKEFILE_LIST))
56
distrib-package:
57
	$(MAKE) -f $(THISFILE) all
58
	$(MAKE) -f $(THISFILE) swftest
59
	$(MAKE) -f $(THISFILE) doc
60
	rm -fr $(PDIR)
61
	cp -R . $(PDIR)
62
	cd $(PDIR) && mv -f makefile_flash makefile && $(CLEAN)
63
	tar czf ../$(PNAME).tgz $(PDIR)
64
	echo Package at ../$(PNAME).tgz
65
66
HXLIBNAME=hxlib
67
HXLIBDIR=../$(HXLIBNAME)
68
HXZIP=../$(HXLIBNAME).zip
69
distrib-haxelib:
70
	#I really only need to do the precomposition stage, don't need final SWFs, but may need libs, and extra HX files... hmmm
71
	$(MAKE) -f $(THISFILE) all
72
	rm -fr $(HXLIBDIR)
73
	cp -R lib/ $(HXLIBDIR)
74
	cd $(HXLIBDIR) && $(CLEAN)
75
	rm -fr $(HXZIP) && zip -qr $(HXZIP) $(HXLIBDIR)
76
	haxelib submit $(HXZIP)
2 by edA-qa mort-ora-y
move makefile
77