-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
134 lines (98 loc) · 3.03 KB
/
makefile
File metadata and controls
134 lines (98 loc) · 3.03 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#
# Setup
#
# This builds both the JSX Client and the JSX Library.
#
# Use 'make help' for help.
#
# installation info
INSTALL_DIR=$(USERPROFILE)\.scripts\jsx
INSTALL_RUN_BAT=$(USERPROFILE)\.scripts\jsx.bat
# where are the sources
JSX_BAT_SRC=.\src\jsx.bat
JSX_SRC=.\src\jsx\jsx.js
LIB_SRC=.\src\lib\*.js
CLIENT_SRC=.\src\client\main.js .\src\client\logger.js .\src\client\command-line-options.js
# setup specific on how to build and delete jsx stuff
COMPILER=node ./bin/jsx-client.js
RM=del /Q
RMDIR=rmdir /S /Q
#
# Make Dependencies
#
.PHONY: clean install
#
# Help
#
# Note the use of dots at the start is to force echo to echo. If the echo
# content is blank then it prints "ECHO is OFF" instead of nothing.
#
help:
@echo .
@echo . JSX make file
@echo . -------------
@echo .
@echo . JSX client = the standalone version of JSX you can use on the
@echo . command line.
@echo .
@echo . JSX library = the library you can use inside another project for
@echo . compiling JSX code.
@echo .
@echo . Commands
@echo .
@echo . make build builds both the JSX client and library
@echo . make build-client builds both the JSX client and library
@echo . make build-library builds both the JSX client and library
@echo .
@echo . make clean deletes the built versions of JSX
@echo . make clean-client deletes just the built JSX client
@echo . make clean-library deletes the build JSX library only
@echo .
@echo . make help prints this help info
@echo .
@echo .
@echo .
all: clean build install
test:
@echo $(INSTALL_DIR)
build: build-client
build-library: dist/jsx.js
build-client: dist/jsx-client.js dist/jsx.bat
#
# Clean Project
#
clean: clean-client clean-library
clean-client:
${RM} .\dist\jsx-client.js >nul 2>&1
${RM} .\dist\jsx.js >nul 2>&1
${RM} .\dist\jsx.bat >nul 2>&1
clean-library:
${RM} .\dist\jsx-library.js >nul 2>&1
#
# Install
#
install: install-client
install-client: build-client uninstall-client
if not exist $(INSTALL_DIR) mkdir $(INSTALL_DIR)
copy /B .\dist\jsx-client.js $(INSTALL_DIR)
copy /B .\dist\jsx.bat $(INSTALL_DIR)
echo %%~dp0\jsx\jsx.bat %%* > $(INSTALL_RUN_BAT)
#
# Uninstall
#
uninstall: uninstall-client
uninstall-client:
if exist $(INSTALL_RUN_BAT) $(RM) $(INSTALL_RUN_BAT)
if exist $(INSTALL_DIR) $(RMDIR) $(INSTALL_DIR)
#
# Building Specific Files
#
# specific file builds
dist/jsx.js: ${JSX_SRC} ${LIB_SRC}
${COMPILER} --src ${JSX_SRC} ${LIB_SRC} -o dist/jsx.js
dist/jsx-client.js: ${JSX_SRC} ${JSX_CLIENT}
${COMPILER} --src ${JSX_SRC} ${CLIENT_SRC} -o dist/jsx-client.js
# copies the bat file for running jsx using binary so it's copied without
# being read (which can happen with ASCII if the file is actually UNICODE)
dist/jsx.bat: ${JSX_BAT_SRC}
copy /B ${JSX_BAT_SRC} .\dist\jsx.bat