Skip to content

Commit

Permalink
Significantly improved Makefile
Browse files Browse the repository at this point in the history
- Support for debug build that doesn't minify the JavaScript
- Only build items that have changed
  • Loading branch information
dgchurchill committed Jun 6, 2011
1 parent 8fb2c1e commit d3e9940
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 17 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Expand Up @@ -3,4 +3,6 @@ data.js
snapshots
.DS_Store
tools
build
debug
release

11 changes: 11 additions & 0 deletions .project
Expand Up @@ -14,4 +14,15 @@
<natures>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
<filteredResources>
<filter>
<id>1307365612160</id>
<name></name>
<type>10</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-true-debug|release</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
53 changes: 37 additions & 16 deletions Makefile
@@ -1,25 +1,46 @@

YUI=java -jar tools/yuicompressor-2.4.6.jar
TYPE=debug

ifeq ($(TYPE),release)
OUTPUTDIR=release
YUI=java -jar tools/yuicompressor-2.4.6.jar --type js
else
OUTPUTDIR=debug
YUI=cat
endif

NANOWASP_JS=nanowasp.js crtc.js crtcmemory.js data.js keyboard.js latchrom.js memmapper.js memory.js microbee.js utils.js z80cpu.js
Z80_JS=z80/z80_full.js z80/z80_ops_full.js
CONTENT=nanowasp.html about.html images/dave.jpg images/monitor.jpg htaccess
IMAGES=$(OUTPUTDIR)/dave.jpg $(OUTPUTDIR)/monitor.jpg


.PHONY: nanowasp
nanowasp: $(OUTPUTDIR)/nanowasp.js $(OUTPUTDIR)/z80.js $(OUTPUTDIR)/index.html $(OUTPUTDIR)/about.html $(IMAGES)

$(OUTPUTDIR)/index.html: nanowasp.html | $(OUTPUTDIR)
cp $< $@

$(OUTPUTDIR)/about.html: about.html | $(OUTPUTDIR)
cp $< $@

$(OUTPUTDIR)/.htaccess: htaccess | $(OUTPUTDIR)
cp $< $@

$(IMAGES): $(OUTPUTDIR)/%: images/%
cp $< $@

all: nanowasp
$(OUTPUTDIR)/nanowasp.js: $(NANOWASP_JS) | $(OUTPUTDIR)
cat $(NANOWASP_JS) | $(YUI) > $@
gzip -c $@ > $@.gz

nanowasp: nanowasp_js z80_js $(CONTENT)
cp $(CONTENT) build
mv build/htaccess build/.htaccess
mv build/nanowasp.html build/index.html
$(OUTPUTDIR)/z80.js: $(Z80_JS) | $(OUTPUTDIR) z80
cat $(Z80_JS) | $(YUI) > $@
gzip -c $@ > $@.gz

nanowasp_js: $(NANOWASP_JS)
mkdir -p build
cat $(NANOWASP_JS) | $(YUI) --type js > build/nanowasp.js
gzip -c build/nanowasp.js > build/nanowasp.js.gz
.PHONY: z80
z80:
cd z80 && $(MAKE)

z80_js: z80/*
cd z80 && make
mkdir -p build
cat $(Z80_JS) | $(YUI) --type js > build/z80.js
gzip -c build/z80.js > build/z80.js.gz
$(OUTPUTDIR):
mkdir -p $@

0 comments on commit d3e9940

Please sign in to comment.