forked from sbarman/webscript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.js
53 lines (45 loc) · 1.33 KB
/
make.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
require('./external/shelljs/make');
var ROOT_DIR = __dirname + '/', // absolute path to project's root
BUILD_DIR = 'build/',
BUILD_TARGET = BUILD_DIR + 'webscript',
FIREFOX_BUILD_DIR = BUILD_DIR + '/firefox/',
CHROME_BUILD_DIR = BUILD_DIR + '/chrome/';
//
// make all
//
target.all = function() {
// Don't do anything by default
echo('Please specify a target. Available targets:');
for (t in target)
if (t !== 'all') echo(' ' + t);
};
//
// make lint
//
target.lint = function() {
cd(ROOT_DIR);
echo();
echo('### Linting JS files (this can take a while!)');
var LINT_FILES = ['make.js',
'src/scripts/background/*.js',
'src/scripts/common/*.js',
'src/scripts/content/*.js',
];
exec('gjslint --nojsdoc ' + LINT_FILES.join(' '));
};
//
// make makefile
//
target.makefile = function() {
var makefileContent = 'help:\n\tnode make\n\n';
var targetsNames = [];
for (var i in target) {
makefileContent += i + ':\n\tnode make ' + i + '\n\n';
targetsNames.push(i);
}
makefileContent += '.PHONY: ' + targetsNames.join(' ') + '\n';
makefileContent.to('Makefile');
};