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
|
||||
|
||||
TARG=github.com/knieriem/markdown
|
||||
GOFILES=\
|
||||
markdown.go\
|
||||
output.go\
|
||||
parser.leg.go\
|
||||
|
||||
package:
|
||||
|
||||
include $(GOROOT)/src/Make.pkg
|
||||
|
||||
all: cmd
|
||||
all:
|
||||
@echo 'targets: test nuke parser clean'
|
||||
|
||||
#
|
||||
# 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
|
||||
make -C cmd test
|
||||
test: package cmd orig-c-src
|
||||
cd orig-c-src/MarkdownTest_1.0.3; \
|
||||
./MarkdownTest.pl --script=../../cmd/markdown/markdown --tidy
|
||||
|
||||
cmd: package
|
||||
make -C cmd
|
||||
cd cmd/markdown && go build -v
|
||||
|
||||
package: parser.leg.go
|
||||
go install -v
|
||||
|
||||
CLEANFILES=\
|
||||
parser.leg.go\
|
||||
_obj\
|
||||
,,c\
|
||||
,,fmt\
|
||||
|
||||
distclean: clean clean-sub
|
||||
clean:
|
||||
go clean . ./...
|
||||
rm -rf orig-c-src
|
||||
rm -rf ,,prevmd ,,pmd
|
||||
|
||||
parser: parser.leg.go
|
||||
|
||||
clean-sub:
|
||||
for dir in cmd peg peg/leg; do make -C $$dir clean; done
|
||||
|
||||
|
||||
VCS = git
|
||||
GITHUB = git://github.com
|
||||
# also, if hggit extension is available:
|
||||
# VCS = hg
|
||||
VCS-PULLFLAGS =
|
||||
nuke:
|
||||
rm -f parser.leg.go
|
||||
|
||||
|
||||
# LEG parser rules
|
||||
#
|
||||
# LEG parser generator stuff
|
||||
#
|
||||
LEG = ./peg/leg/leg
|
||||
ifeq ($(MAKECMDGOALS),parser)
|
||||
include $(shell go list -f '{{.Dir}}' github.com/knieriem/peg)/Make.inc
|
||||
%.leg.go: %.leg $(LEG)
|
||||
$(LEG) -switch $<
|
||||
|
||||
$(LEG):
|
||||
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
|
||||
endif
|
||||
|
||||
|
||||
#
|
||||
# access to original C source files
|
||||
# get access to original C source files
|
||||
#
|
||||
|
||||
orig-c-src:
|
||||
$(VCS) clone $(GITHUB)/jgm/peg-markdown.git $@
|
||||
|
||||
hg clone git://github.com/jgm/peg-markdown.git $@
|
||||
|
||||
|
||||
include misc/devel.mk
|
||||
|
||||
.PHONY: \
|
||||
all\
|
||||
cmd\
|
||||
distclean\
|
||||
mdtest\
|
||||
nuke\
|
||||
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
|
||||
|
||||
import (
|
||||
"../_obj/github.com/knieriem/markdown"
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/knieriem/markdown"
|
||||
"os"
|
||||
"bufio"
|
||||
"io/ioutil"
|
@ -1,12 +1,13 @@
|
||||
#!/usr/local/plan9/bin/rc
|
||||
|
||||
nrun=20
|
||||
md=./cmd/markdown/markdown
|
||||
|
||||
fn timego{
|
||||
run ./cmd/markdown go
|
||||
run $md go
|
||||
}
|
||||
fn timegoprev{
|
||||
run ./,,prevmd/cmd/markdown goprev
|
||||
run ./,,prevmd/src/github.com/knieriem/markdown/$md goprev
|
||||
}
|
||||
|
||||
fn timec{
|
||||
|
@ -3,26 +3,28 @@
|
||||
flag e +
|
||||
|
||||
fn updatetree{ # hg-id dir hg-url make-target
|
||||
wd=`{pwd}
|
||||
if (test -d $2) {
|
||||
cd $2
|
||||
if (! ~ `{hg id -n} $1) {
|
||||
hg update $1
|
||||
make $4
|
||||
}
|
||||
cd ..
|
||||
cd $wd
|
||||
}
|
||||
if (! test -d $2) {
|
||||
hg clone $3 $2
|
||||
cd $2
|
||||
hg update $1
|
||||
make $4
|
||||
cd ..
|
||||
cd $wd
|
||||
}
|
||||
~ 0 0
|
||||
}
|
||||
|
||||
test -f portid
|
||||
test -f previd
|
||||
mkdir -p ,,prevmd/src/github.com/knieriem
|
||||
|
||||
id=`{cat portid}
|
||||
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}
|
||||
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
|
||||
#
|
||||
@ -24,9 +26,9 @@ benchmark: m ,,pmd ,,prevmd
|
||||
# pprof
|
||||
#
|
||||
pprof: cmd m
|
||||
./cmd/markdown -cpuprofile /tmp/md.prof <m > /tmp/,,md.out
|
||||
@echo gopprof \'--nodefraction=0.1\' ./cmd/markdown /tmp/md.prof
|
||||
@echo gopprof ./cmd/markdown /tmp/md.prof
|
||||
$(MD) -cpuprofile /tmp/md.prof <m > /tmp/,,md.out
|
||||
@echo gopprof \'--nodefraction=0.1\' $(MD) /tmp/md.prof
|
||||
@echo gopprof $(MD) /tmp/md.prof
|
||||
|
||||
.PHONY:\
|
||||
diff\
|
||||
|
Loading…
Reference in New Issue
Block a user