Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 27 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# Detect if we're running Windows
ifeq ($(OS),Windows_NT)
# If so, set the file & folder deletion commands:
FixPath = $(subst /,\,$1)
Remove = CMD.EXE /C DEL /F
ReadFile = TYPE
WritePerm = ICACLS $1 /GRANT $(USERNAME):(W)
else
# Otherwise, assume we're running *N*X:
FixPath = $1
Remove = rm -f
ReadFile = cat
WritePerm = chmod -w $1
endif

JS_COMPILER = ./node_modules/uglify-js/bin/uglifyjs

all: rserve.js rserve.min.js main.js
Expand Down Expand Up @@ -27,27 +42,27 @@ rserve.js: \
src/_end.js

rserve.min.js: rserve.js Makefile
@rm -f $@
$(JS_COMPILER) < $< > $@
chmod -w $@
@$(Remove) $@
$(call FixPath, node $(JS_COMPILER)) < $< > $@
$(call WritePerm, $@)

rserve.js: Makefile
echo $^
@rm -f $@
cat $(filter %.js,$^) > $@
@echo $^
@$(Remove) $@
$(ReadFile) $(call FixPath, $(filter %.js,$^)) > $@
ifeq ($(CHECK),1)
jshint $(filter %.js,$(filter-out lib/%.js,$(filter-out %/_begin.js,$(filter-out %/_end.js, $^))))
endif
chmod -w $@
$(call WritePerm, $@)

main.js: Makefile
echo $^
@rm -f $@
cat $(filter %.js,$^) > $@
@echo $^
@$(Remove) $@
$(ReadFile) $(call FixPath, $(filter %.js,$^)) > $@
ifeq ($(CHECK),1)
jshint $(filter %.js,$(filter-out lib/%.js,$(filter-out %/_begin.js,$(filter-out %/_end.js, $^))))
endif
chmod -w $@
$(call WritePerm, $@)

clean:
rm -f rserve.js rserve.min.js main.js
$(Remove) rserve.js rserve.min.js main.js
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ equivalent of a *chainsaw*: there are ways to use it safely,
Start Rserve in web-sockets mode:

$ cd rserve-js/tests
$ r_files/start_no_ocap
$ r_files/start_no_ocap

Run some javascript that connects to [port 8081](https://github.com/cscheid/rserve-js/blob/master/tests/r_files/no_oc.conf):

$ node
$ node

> r = require('../main.js')
{ Robj:
Expand Down Expand Up @@ -108,3 +108,13 @@ can return other capabilities, and so a system can be designed to
provide, by default, a very limited set of features, which can be
increased when appropriate.


## Building on Windows

Download the latest
[GNU Make for Windows](http://gnuwin32.sourceforge.net/packages/make.htm)
Binaries and Dependencies Zips and extract the contents in their
respective bin/ folders to the directory containing the Makefile.
Open up cmd.exe, navigate to that same directory, and execute:

> make.exe all
Loading