use the `go' tool where possible
--HG-- rename : cmd/main.go => cmd/markdown/main.go
This commit is contained in:
parent
0f439963e6
commit
ac729cbd2f
80
Makefile
80
Makefile
@ -1,79 +1,53 @@
|
|||||||
include $(GOROOT)/src/Make.inc
|
all:
|
||||||
|
@echo 'targets: test nuke parser clean'
|
||||||
TARG=github.com/knieriem/markdown
|
|
||||||
GOFILES=\
|
|
||||||
markdown.go\
|
|
||||||
output.go\
|
|
||||||
parser.leg.go\
|
|
||||||
|
|
||||||
package:
|
|
||||||
|
|
||||||
include $(GOROOT)/src/Make.pkg
|
|
||||||
|
|
||||||
all: cmd
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# mdtest runs MarkdownTests-1.0.3 that come with original C sources
|
# run MarkdownTests-1.0.3 that come with original C sources
|
||||||
#
|
#
|
||||||
mdtest: package cmd orig-c-src
|
test: package cmd orig-c-src
|
||||||
make -C cmd test
|
cd orig-c-src/MarkdownTest_1.0.3; \
|
||||||
|
./MarkdownTest.pl --script=../../cmd/markdown/markdown --tidy
|
||||||
|
|
||||||
cmd: package
|
cmd: package
|
||||||
make -C cmd
|
cd cmd/markdown && go build -v
|
||||||
|
|
||||||
|
package: parser.leg.go
|
||||||
|
go install -v
|
||||||
|
|
||||||
CLEANFILES=\
|
clean:
|
||||||
parser.leg.go\
|
go clean . ./...
|
||||||
_obj\
|
|
||||||
,,c\
|
|
||||||
,,fmt\
|
|
||||||
|
|
||||||
distclean: clean clean-sub
|
|
||||||
rm -rf orig-c-src
|
rm -rf orig-c-src
|
||||||
|
rm -rf ,,prevmd ,,pmd
|
||||||
|
|
||||||
|
parser: parser.leg.go
|
||||||
|
|
||||||
clean-sub:
|
nuke:
|
||||||
for dir in cmd peg peg/leg; do make -C $$dir clean; done
|
rm -f parser.leg.go
|
||||||
|
|
||||||
|
|
||||||
VCS = git
|
|
||||||
GITHUB = git://github.com
|
|
||||||
# also, if hggit extension is available:
|
|
||||||
# VCS = hg
|
|
||||||
VCS-PULLFLAGS =
|
|
||||||
|
|
||||||
|
|
||||||
|
# LEG parser rules
|
||||||
#
|
#
|
||||||
# LEG parser generator stuff
|
ifeq ($(MAKECMDGOALS),parser)
|
||||||
#
|
include $(shell go list -f '{{.Dir}}' github.com/knieriem/peg)/Make.inc
|
||||||
LEG = ./peg/leg/leg
|
|
||||||
%.leg.go: %.leg $(LEG)
|
%.leg.go: %.leg $(LEG)
|
||||||
$(LEG) -switch $<
|
$(LEG) -switch $<
|
||||||
|
|
||||||
$(LEG):
|
endif
|
||||||
if(! test -d peg); then make peg; fi
|
|
||||||
make -C peg all GOOS=$(GOHOSTOS) GOARCH=$(GOHOSTARCH)
|
|
||||||
make -C peg/leg all GOOS=$(GOHOSTOS) GOARCH=$(GOHOSTARCH)
|
|
||||||
|
|
||||||
peg:
|
|
||||||
$(VCS) clone $(GITHUB)/knieriem/peg
|
|
||||||
|
|
||||||
update-peg:
|
|
||||||
cd peg && $(VCS) pull $(VCS-PULLFLAGS)
|
|
||||||
cd peg/leg && make clean
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# access to original C source files
|
# get access to original C source files
|
||||||
#
|
#
|
||||||
|
|
||||||
orig-c-src:
|
orig-c-src:
|
||||||
$(VCS) clone $(GITHUB)/jgm/peg-markdown.git $@
|
hg clone git://github.com/jgm/peg-markdown.git $@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
include misc/devel.mk
|
include misc/devel.mk
|
||||||
|
|
||||||
.PHONY: \
|
.PHONY: \
|
||||||
|
all\
|
||||||
cmd\
|
cmd\
|
||||||
distclean\
|
nuke\
|
||||||
mdtest\
|
package\
|
||||||
|
parser\
|
||||||
|
test\
|
||||||
|
16
cmd/Makefile
16
cmd/Makefile
@ -1,16 +0,0 @@
|
|||||||
include $(GOROOT)/src/Make.inc
|
|
||||||
|
|
||||||
TARG=markdown
|
|
||||||
GOFILES=\
|
|
||||||
main.go\
|
|
||||||
|
|
||||||
LIBMD = github.com/knieriem/markdown
|
|
||||||
R = ..
|
|
||||||
PREREQ += $(R)/_obj/$(LIBMD).a
|
|
||||||
|
|
||||||
include $(GOROOT)/src/Make.cmd
|
|
||||||
|
|
||||||
|
|
||||||
test: $(TARG)
|
|
||||||
cd $(R)/orig-c-src/MarkdownTest_1.0.3; \
|
|
||||||
./MarkdownTest.pl --script=../../cmd/$< --tidy
|
|
@ -1,9 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"../_obj/github.com/knieriem/markdown"
|
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/knieriem/markdown"
|
||||||
"os"
|
"os"
|
||||||
"bufio"
|
"bufio"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
@ -1,12 +1,13 @@
|
|||||||
#!/usr/local/plan9/bin/rc
|
#!/usr/local/plan9/bin/rc
|
||||||
|
|
||||||
nrun=20
|
nrun=20
|
||||||
|
md=./cmd/markdown/markdown
|
||||||
|
|
||||||
fn timego{
|
fn timego{
|
||||||
run ./cmd/markdown go
|
run $md go
|
||||||
}
|
}
|
||||||
fn timegoprev{
|
fn timegoprev{
|
||||||
run ./,,prevmd/cmd/markdown goprev
|
run ./,,prevmd/src/github.com/knieriem/markdown/$md goprev
|
||||||
}
|
}
|
||||||
|
|
||||||
fn timec{
|
fn timec{
|
||||||
|
@ -3,26 +3,28 @@
|
|||||||
flag e +
|
flag e +
|
||||||
|
|
||||||
fn updatetree{ # hg-id dir hg-url make-target
|
fn updatetree{ # hg-id dir hg-url make-target
|
||||||
|
wd=`{pwd}
|
||||||
if (test -d $2) {
|
if (test -d $2) {
|
||||||
cd $2
|
cd $2
|
||||||
if (! ~ `{hg id -n} $1) {
|
if (! ~ `{hg id -n} $1) {
|
||||||
hg update $1
|
hg update $1
|
||||||
make $4
|
make $4
|
||||||
}
|
}
|
||||||
cd ..
|
cd $wd
|
||||||
}
|
}
|
||||||
if (! test -d $2) {
|
if (! test -d $2) {
|
||||||
hg clone $3 $2
|
hg clone $3 $2
|
||||||
cd $2
|
cd $2
|
||||||
hg update $1
|
hg update $1
|
||||||
make $4
|
make $4
|
||||||
cd ..
|
cd $wd
|
||||||
}
|
}
|
||||||
~ 0 0
|
~ 0 0
|
||||||
}
|
}
|
||||||
|
|
||||||
test -f portid
|
test -f portid
|
||||||
test -f previd
|
test -f previd
|
||||||
|
mkdir -p ,,prevmd/src/github.com/knieriem
|
||||||
|
|
||||||
id=`{cat portid}
|
id=`{cat portid}
|
||||||
echo '*' prepare original c-based peg-markdown $id
|
echo '*' prepare original c-based peg-markdown $id
|
||||||
@ -30,4 +32,6 @@ updatetree $id ,,pmd git://github.com/jgm/peg-markdown.git ()
|
|||||||
|
|
||||||
id=`{cat previd}
|
id=`{cat previd}
|
||||||
echo '*' prepare "previous version" $id
|
echo '*' prepare "previous version" $id
|
||||||
updatetree $id ,,prevmd . all
|
cd ,,prevmd
|
||||||
|
GOPATH=`{pwd}
|
||||||
|
updatetree $id src/github.com/knieriem/markdown .. cmd
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
MD=./cmd/markdown/markdown
|
||||||
|
|
||||||
#
|
#
|
||||||
# development utilities
|
# development utilities
|
||||||
#
|
#
|
||||||
@ -24,9 +26,9 @@ benchmark: m ,,pmd ,,prevmd
|
|||||||
# pprof
|
# pprof
|
||||||
#
|
#
|
||||||
pprof: cmd m
|
pprof: cmd m
|
||||||
./cmd/markdown -cpuprofile /tmp/md.prof <m > /tmp/,,md.out
|
$(MD) -cpuprofile /tmp/md.prof <m > /tmp/,,md.out
|
||||||
@echo gopprof \'--nodefraction=0.1\' ./cmd/markdown /tmp/md.prof
|
@echo gopprof \'--nodefraction=0.1\' $(MD) /tmp/md.prof
|
||||||
@echo gopprof ./cmd/markdown /tmp/md.prof
|
@echo gopprof $(MD) /tmp/md.prof
|
||||||
|
|
||||||
.PHONY:\
|
.PHONY:\
|
||||||
diff\
|
diff\
|
||||||
|
Loading…
Reference in New Issue
Block a user