Permalink
Browse files

Updates and fixes to build system.

GNU's cpp requires -traditional-cpp, while OS X's one does not.

Ensure `coffee` and `uglifyjs` are of the right version.
  • Loading branch information...
1 parent 720f77f commit 22f68b122ba7721c3689035917d0416e19328efe @int3 int3 committed Apr 30, 2012
Showing with 26 additions and 9 deletions.
  1. +9 −3 Makefile
  2. +17 −3 README.md
  3. +0 −3 startup.sh
View
12 Makefile
@@ -1,3 +1,6 @@
+COFFEEC = coffee # path to coffeescript compiler
+UGLIFYJS = node_modules/uglify-js/bin/uglifyjs
+
SOURCES = $(wildcard test/*.java)
DISASMS = $(SOURCES:.java=.disasm)
RUNOUTS = $(SOURCES:.java=.runout)
@@ -84,17 +87,17 @@ browser/_about.html: browser/_about.md
build/about.html: browser/_about.html
build/%.html: $(BROWSER_HTML) $(wildcard browser/_*.html)
- cpp -P -DRELEASE browser/$*.html build/$*.html
+ cpp -P -traditional-cpp -DRELEASE browser/$*.html build/$*.html
build/compressed.js: $(BROWSER_SRCS)
for src in $(BROWSER_SRCS); do \
if [ "$${src##*.}" == "coffee" ]; then \
- cat $${src} | gsed -r "s/^ *(debug|trace).*$$//" | coffee --stdio --print; \
+ cat $${src} | gsed -r "s/^ *(debug|trace).*$$//" | $(COFFEEC) --stdio --print; \
else \
cat $${src}; \
fi; \
echo ";"; \
- done | uglifyjs --define RELEASE --no-mangle --unsafe > build/compressed.js
+ done | $(UGLIFYJS) --define RELEASE --no-mangle --unsafe > build/compressed.js
build/ace.js: $(ACE_SRCS)
for src in $(ACE_SRCS); do \
@@ -108,5 +111,8 @@ build/browser/style.css: third_party/bootstrap/css/bootstrap.min.css browser/sty
browser/mini-rt.tar: tools/preload
tools/make-rt.sh
+$(UGLIFYJS):
+ npm install https://github.com/downloads/int3/UglifyJS/uglify.tar.gz
+
.SECONDARY: $(CLASSES) $(DISASMS) $(RUNOUTS) $(DEMO_CLASSES)
.INTERMEDIATE: browser/_about.html
View
20 README.md
@@ -23,21 +23,35 @@ Most programs need the Java Class Library. On OS X Lion:
cd third_party/classes
unzip /System/Library/Frameworks/JavaVM.framework/Classes/classes.jar
-Use [Coffeescript v1.2.0](http://coffeescript.org/) (which is the default version you get from npm).
+Use [Coffeescript v1.2.0](http://coffeescript.org/):
+
+ npm install -g coffee-script@1.2.0
+
Run `coffee -wc */*.coffee &` to auto-generate javascript sources if you make any changes to the code.
If you want to run the console-based frontend, you'll need the `optimist` node.js library:
npm install optimist
+To build the release copy of the code, you'll need [rdiscount][rdisc] as well.
+
+[rdisc]: https://github.com/rtomayko/rdiscount
+
Usage
-----
To run Doppio on localhost, run `. startup.sh`, or start the browser frontend manually:
+ cpp -P -traditional-cpp browser/index.html index.html
python -m SimpleHTTPServer 8000 &
- cpp -P browser/index.html index.html
- open http://localhost:8000/
+
+To get the optimized release version:
+
+ make release
+ cd build
+ python -m SimpleHTTPServer 8000 &
+
+Then point your browser to http://localhost:8000/.
The code can also be run from the console. For example:
View
3 startup.sh
@@ -5,8 +5,5 @@ make java
make browser/mini-rt.tar
sleep 1 # make sure we have time to compile everything
cpp -P browser/index.html index.html
-rdiscount browser/_about.md >browser/_about.html
-cpp -P browser/about.html about.html
-cp browser/_navbar.html _navbar.html
tools/watch.coffee &
open http://localhost:8000/

0 comments on commit 22f68b1

Please sign in to comment.