shithub: h264bsd

Download patch

ref: 3679d082c528461bb2511aa2a404cb03a9f19b7c
parent: 9121b8f360812e14e422809082fed8b7cea4ae40
author: Sam Leitch <sam.leitch@calgaryscientific.com>
date: Wed Mar 19 07:29:13 EDT 2014

Switched make to rake.

--- a/flex/Makefile
+++ /dev/null
@@ -1,36 +1,0 @@
-SOURCES = $(wildcard ../src/*.c) main.c
-AS_SOURCES = $(wildcard src/h264bsd/*.as)
-
-FLASCC:=X
-FLEX:=X
-BASE_CFLAGS:=-DFLASCC -O4 -I $(FLASCC)/usr/include
-
-swc: bin/h264bsd.swc
-
-test: test/h264test.swf
-
-lib/h264bsd_asm.swc: $(SOURCES)
-	@if [ -d $(FLASCC)/usr/bin ] ; then true ; \
-	else echo "Couldn't locate FLASCC sdk directory, please invoke make with \"make FLASCC=/path/to/FLASCC/sdk ...\"" ; exit 1 ; \
-	fi
-
-	mkdir -p lib
-	"$(FLASCC)/usr/bin/gcc" $(BASE_CFLAGS) $(SOURCES) -emit-swc=h264bsd_asm -o lib/h264bsd_asm.swc
-
-bin/h264bsd.swc: lib/h264bsd_asm.swc $(AS_SOURCES)
-	@if [ -d "$(FLEX)/bin" ] ; then true ; \
-	else echo "Couldn't locate Flex sdk directory, please invoke make with \"make FLEX=/path/to/flex  ...\"" ; exit 1 ; \
-	fi
-
-	mkdir -p bin
-	"$(FLEX)/bin/compc" -library-path=lib/h264bsd_asm.swc -source-path=src -include-sources=src -o bin/h264bsd.swc
-
-test/h264test.swf: test/h264test.mxml bin/h264bsd.swc
-	@if [ -d "$(FLEX)/bin" ] ; then true ; \
-	else echo "Couldn't locate Flex sdk directory, please invoke make with \"make FLEX=/path/to/flex  ...\"" ; exit 1 ; \
-	fi
-
-	"$(FLEX)/bin/mxmlc" -static-link-runtime-shared-libraries -compiler.omit-trace-statements=false -library-path+=bin/h264bsd.swc -library-path+=$(FLEX)/frameworks/libs/ -debug=true test/h264test.mxml -o test/h264test.swf
-
-clean:
-	rm -f *.swc *.swf bin/*.swc *.bc *.exe test/*.swf lib/*.swc
--- a/flex/Rakefile
+++ b/flex/Rakefile
@@ -7,13 +7,13 @@
 
 def check_flascc()
     unless File.directory?("#{FLASCC}/usr/bin")
-        fail("Couldn't locate FLASCC sdk directory, please invoke make with \"FLASCC=/path/to/FLASCC/sdk rake ...\"")
+        fail("Couldn't locate FLASCC sdk directory, please invoke make with \"rake FLASCC=/path/to/FLASCC/sdk ...\"")
     end
 end
 
 def check_flex()
     unless File.directory?("#{FLEX}/bin")
-        fail("Couldn't locate Flex sdk directory, please invoke make with \"FLEX=/path/to/flex rake ...\"")
+        fail("Couldn't locate Flex sdk directory, please invoke make with \"rake FLEX=/path/to/flex ...\"")
     end
 end
 
@@ -23,20 +23,26 @@
 
 task :test => ["test/h264test.swf"]
 
-file "lib/h264bsd_asm.swc" => SOURCES
-    check_flex()
-    FileUtils.mkdir_p("lib")
+directory "lib"
+
+directory "bin"
+
+file "lib/h264bsd_asm.swc" => ["lib"] + SOURCES do
+    check_flascc()
     sh("\"#{FLASCC}/usr/bin/gcc\" #{BASE_CFLAGS} #{SOURCES} -emit-swc=h264bsd_asm -o lib/h264bsd_asm.swc");
+end
 
-file "bin/h264bsd.swc" => AS_SOURCES + "lib/h264bsd_asm.swc"
+file "bin/h264bsd.swc" => ["lib/h264bsd_asm.swc", "bin"] + AS_SOURCES do
     check_flex()
-    FileUtils.mkdir_p("bin")
     sh("\"#{FLEX}/bin/compc\" -library-path=lib/h264bsd_asm.swc -source-path=src -include-sources=src -o bin/h264bsd.swc")
+end
 
-file "test/h264test.swf" => ["test/h264test.mxml", "bin/h264bsd.swc"]
+file "test/h264test.swf" => ["test/h264test.mxml", "bin/h264bsd.swc"] do
     check_flex()
     sh("\"#{FLEX}/bin/mxmlc\" -static-link-runtime-shared-libraries -compiler.omit-trace-statements=false -library-path+=bin/h264bsd.swc -library-path+=#{FLEX}/frameworks/libs/ -debug=true test/h264test.mxml -o test/h264test.swf")
+end
 
 task :clean do
-    FileUtils.rm_f(["*.swc", "*.swf", "bin/*.swc", "*.bc", "*.exe", "test/*.swf", "lib/*.swc"])
+    FileUtils.rm_rf(["lib", "bin"])
+    FileUtils.rm_f(FileList["*.swc", "*.swf", "*.bc", "*.exe", "test/*.swf"])
 end