Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
# By Edrx, 2008jan22 # This is my script to make the tgz: # (find-es "blogme" "blogme3.tgz") # (find-sh "cd ~/blogme3/ && make") # Usage: on linux, # cd ~/blogme3/; make # on BSDs: # cd ~/blogme3/; make LUAOS=bsd # on zumbi, a BSD box in the same net of persephone: # cd ~/blogme3/; make LUAOS=bsd ANGGBASE=http://10.1.0.101/TH/R/ # on persephone or angg (linux boxes with $S and external binaries): # cd ~/blogme3/; make S=$S testb # Note: on macosx things are harder - we need to use LUAOS=macosx to # compile lua, and different gcc flags (and maybe an environment # variable?) to compile lpeg... and right now the gcc flags that I use # for lpeg are hard-coded in the makefile, see the "lpegbuild" and # "$(LPEGSO_)" targets below... # This message shows flags that seem to work: # http://lua-users.org/lists/lua-l/2007-04/msg00589.html # that is, # export MACOSX_DEPLOYMENT_TARGET=10.3 # gcc -bundle -undefined dynamic_lookup -Wall -O2 -o lpeg.so lpeg.c # (find-node "(make)Setting" "FOO ?= bar") # (find-node "(make)Instead of Execution" "`-n'") # (find-node "(make)Errors" "-rm -f *.o") # (find-es "make" "environment") # (find-es "lua5" "install-5.1.2") # Note: LUASRC must be absolute (a directory). # (LPEGSRC too?) S = snarf USRC = usrc # ANGGBASE = http://10.1.0.101/TH/R/ ANGGBASE = http://angg.twu.net/ LUAURL = http://www.lua.org/ftp/lua-5.1.2.tar.gz LUATGZ = $(S)/http/www.lua.org/ftp/lua-5.1.2.tar.gz LUATGZDIR = $(S)/http/www.lua.org/ftp/ LUASRC = $(PWD)/usrc/lua-5.1.2 LUA51_ = $(LUASRC)/src/lua LUA51 = ./lua51 LUAOS = linux LPEGURL = http://www.inf.puc-rio.br/~roberto/lpeg-0.7.tar.gz LPEGTGZ = $(S)/http/www.inf.puc-rio.br/~roberto/lpeg-0.7.tar.gz LPEGTGZDIR = $(S)/http/www.inf.puc-rio.br/~roberto/ LPEGSRC = $(PWD)/usrc/lpeg-0.7 LPEGSO_ = $(LPEGSRC)/lpeg.so LPEGSO = lpeg.so LUA51_ANGG = $(HOME)/bin/lua51 LPEGSO_ANGG = $(HOME)/usrc/lpeg-0.7/lpeg.so default: test clean: cleanbinaries cleanscripts # (find-eevfile "Makefile" "/tmp/eev-current.tar.gz:") # (find-es "omnisys") # (find-es "blogme" "blogme3.tgz") #blogme3.tgz: # (TZ=GMT date; date) > VERSION # tar -cvzf $@ $$(cat .files) luadownload: $(LUATGZ) $(LUATGZ): mkdir -p $(LUATGZDIR) cd $(LUATGZDIR) && \ wget $(LUAURL) lpegdownload: $(LPEGTGZ) $(LPEGTGZ): mkdir -p $(LPEGTGZDIR) cd $(LPEGTGZDIR) && \ wget $(LPEGURL) luabuild: $(LUA51_) $(LUA51_): $(LUATGZ) -rm -Rv $(LUASRC)/ mkdir -p $(USRC)/ tar -C $(USRC)/ -xvzf $(LUATGZ) cd $(LUASRC) && make $(LUAOS) test lpegbuild: $(LPEGTGZ) $(LPEGSO_): $(LPEGTGZ) -rm -Rv $(LPEGSRC)/ mkdir -p $(USRC)/ tar -C $(USRC)/ -xvzf $(LPEGTGZ) cd $(LPEGSRC) && \ chmod 644 * && \ gcc -g -Wall -shared -I$(LUASRC)/src -o lpeg.so lpeg.c && \ $(LUA51_) test.lua # 2008feb17: new targets, unused luaunpack: $(LUATGZ) -rm -Rv $(LUASRC)/ mkdir -p $(USRC)/ tar -C $(USRC)/ -xvzf $(LUATGZ) luacompile: cd $(LUASRC) && make $(LUAOS) test lpegunpack: $(LPEGTGZ) -rm -Rv $(LPEGSRC)/ mkdir -p $(USRC)/ tar -C $(USRC)/ -xvzf $(LPEGTGZ) cd $(LPEGSRC) && chmod 644 * lpegcompile: cd $(LPEGSRC) && \ gcc -g -Wall -shared -I$(LUASRC)/src -o lpeg.so lpeg.c && \ $(LUA51_) test.lua lpegcompile_macosx: cd $(LPEGSRC) && \ export MACOSX_DEPLOYMENT_TARGET=10.3 && \ gcc -bundle -undefined dynamic_lookup -Wall -O2 -o lpeg.so lpeg.c && \ $(LUA51_) test.lua # (find-lua51file "Makefile" "test:") # (find-lpegfile "makefile") luatest: $(LUA51) cd $(LUASRC) && $(LUA51) test/hello.lua lpegtest: $(LUA51) $(LPEGSO) cd $(LPEGSRC) && $(LUA51) test.lua # (find-node "(make)Automatic Variables") # cp -v $< $@ #$(LUA51): $(LUA51_) # cp -v $(LUA51_) $(LUA51) #$(LPEGSO): $(LPEGSO_) # cp -v $(LPEGSO_) $(LPEGSO) cleanbinaries: -rm -v $(LUA51) -rm -v $(LPEGSO) compilebinaries: cleanbinaries $(LUA51_) $(LPEGSO_) cp -v $(LUA51_) $(LUA51) cp -v $(LPEGSO_) $(LPEGSO) linkbinaries: cleanbinaries ln -s $(LUA51_ANGG) $(LUA51) ln -s $(LPEGSO_ANGG) $(LPEGSO) # This can be more flexible... blogme3: blogme3.lua cat blogme3.lua | { echo "#!$(PWD)/lua51"; awk 'NR>1'; } > blogme3 chmod 755 blogme3 a2html: { echo '#!/bin/sh'; \ echo 'run () { echo $$*; $$*; }'; \ echo 'run $(PWD)/blogme3 -anggat $(ANGGBASE) -o $$1.html -a2html $$1'; \ } > a2html chmod 755 a2html t2html: { echo '#!/bin/sh'; \ echo 'run () { echo $$*; $$*; }'; \ echo 'run $(PWD)/blogme3 -anggat $(ANGGBASE) -o $$1.html -t2html $$1'; \ } > t2html chmod 755 t2html w2html: { echo '#!/bin/sh'; \ echo 'run () { echo $$*; $$*; }'; \ echo 'run $(PWD)/blogme3 -anggat $(ANGGBASE) -o $$1.html -w2html $$1'; \ } > w2html chmod 755 w2html lstoindexhtml: lstoindexhtml.lua { echo "#!$(PWD)/lua51"; cat lstoindexhtml.lua; } > lstoindexhtml chmod 755 lstoindexhtml lstoindexhtml-here: lstoindexhtml { echo "#!/bin/sh"; \ echo "rm -f index.html"; \ echo "ls -laF | col -x | $(PWD)/lstoindexhtml . > index.html"; \ } > lstoindexhtml-here chmod 755 lstoindexhtml-here scripts: blogme3 a2html t2html w2html lstoindexhtml lstoindexhtml-here cleanscripts: -rm -v blogme3 -rm -v a2html -rm -v t2html -rm -v w2html -rm -v lstoindexhtml -rm -v lstoindexhtml-here test: compilebinaries scripts ./blogme3 -o blogme3.html -i TH/blogme3.blogme ./lstoindexhtml-here testb: linkbinaries scripts ./blogme3 -o blogme3.html -i TH/blogme3.blogme ./lstoindexhtml-here