-
Notifications
You must be signed in to change notification settings - Fork 4
/
Rules.mk
166 lines (127 loc) · 3.86 KB
/
Rules.mk
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
include $(MK_SHARE)Core/Main.dirstack.mk
MK += $/Rules.mk
#### Old rules
#
#_default:
# @echo "make var/enf/%.enf ENF_DIR=path/to/files"
# @echo " Build enfilade from directory"
# @echo " E.g. use: make var/enf/name.enf ENF_DIR='var/htdocs/0.empty'"
# @echo " Generates new (overwrites) FeBe content-script and enf.enf."
# @echo "Run"
# @echo " run - for pyxi frontend"
# @echo " server - for TCP server"
# # TODO: links, the old demo docs don't have many
#
##$(CONTENT_SCRIPT): $(CONTENT_LIST)
## @echo "Create a FeBe script for xumain which inserts contents from files"
## create-content-script.py $< > $@
#
#### end old
# Enfilade directories, see below.
ENFS = \
EMPTY=var/enf/0.empty.enf;\
OLDDEMO=var/enf/1.olddemo.enf;\
WIKI=var/enf/Xanadu-archaeology.enf;\
DEMO=var/enf/sample.enf;
ENF_DIRS = \
EMPTY=var/htdocs/0.empty/;\
OLDDEMO=var/htdocs/1.olddemo/;\
WIKI=var/htdocs/Xanadu-archaeology/;
# Current enfilade directory
ENF_DIR=EMPTY
# Contents of enfilade directory
#CONTENT_LIST=$(ENF_DIR)/content.list
CONTENT_SCRIPT=$(ENF_DIR)/init-content.febe
LINK_SCRIPT=$(ENF_DIR)/init-links.febe
# stuff to clean (see also git clean -df)
CLN += $(shell find $/ -iname '*.pyc' -or -path 'bin/be/x88.*' -or -name 'gmon.out' -or -name 'backenderror')
### Tests
_test:
python test/Tumbler.py
### Special targets
T := $(call mkid,$(d)enf)
DESCRIPTION += $(T)='Build an enfilade from CONTENT_SCRIPT and LINK_SCRIPT'
STRGT += $(T)
$T: ENF := EMPTY
$(T):
@-if test -f enf.enf; then rm -v enf.enf; fi;
@\
ENF=$(ENF);\
! [ -z "$$ENF" ] || exit 50;\
declare $(ENF_DIRS)\
enf_dir=$${!ENF};\
declare $(ENFS)\
enf=$${!ENF};\
\
content_script=$$enf_dir/init-content.febe;\
link_script=$$enf_dir/init-links.febe;\
\
cd $$enf_dir;\
\
echo;echo "Initializing and inserting text...";\
../../../bin/green/be_source/xumain < ../../../$$content_script;\
\
echo;echo "Inserting links...";\
../../../bin/green/be_source/backend < ../../../$$link_script; echo;\
\
cd ./$$(echo $$enf_dir | sed 's/[^\/]\+/../g');\
mv $$enf_dir/enf.enf $$enf;\
echo;echo Ready, size:;\
wc -c $$enf
define install-enf
ENF=$(ENF);\
declare $(ENF_DIRS)\
enf_dir=$${!ENF};\
declare $(ENFS)\
enf=$${!ENF};\
cd bin/be; echo pwd=$$(pwd); rm -v enf.enf; ln -vs ../../$$enf enf.enf
endef
define run-pyxi
echo -e "\nImportant: Use alt-q to exit (and wait for the backend to close)\n";\
echo "Need to fix tkinter event handers.."
cd $(<D); ./$(<F)
endef
T := $(call mkid,$drun)
DESCRIPTION += $(T)='Run pyxi normally (autoruns backend and connects through pipe). Use ENF=.. to select enfilade. '
STRGT += $(T)
$T: ENF := EMPTY
$(T): $/bin/pyxi
@$(install-enf)
@$(run-pyxi)
T := $(call mkid,$ddebug)
DESCRIPTION += $(T)='Run pyxi in verbose mode, use ENF=.. to select enfilade.'
STRGT += $(T)
$T: ENF := EMPTY
$(T): $/bin/pyxi
@$(install-enf)
@$(run-pyxi) -d
T := $(call mkid,$(d)server)
DESCRIPTION += $T='Run server with -t CONN -b BE'
STRGT += $T
$T: ENF := EMPTY
$T: DIR := $/
$T: CONN := localhost:55146
$T: BE := be/backend
$T: $/bin/x-be-pipestream-tcpwrapper.py
@$(install-enf)
@cd $(DIR); ./bin/$(<F) -l -t $(CONN) -b $(BE)
T := $(call mkid,$dclient)
DESCRIPTION += $(T)='Run pyxi verbose and in client mode (connects to localhost:55146)'
STRGT += $(T)
$(T): $/bin/pyxi
@$(run-pyxi) -d -t
T := $(call mkid,$(d)prompt)
DESCRIPTION += $T='Interactive session (Python) for Xu88.1 backend'
STRGT += $T
$T: ENF := EMPTY
$T: PY := ipython
$T: BE := $/be/backend
$T: $/bin/x-interactive-session.py
@$(ll) file_target "$@" "Starting interactive session"
@$(install-enf)
@cd $(<D);$(PY) -i -- $(<F) -l -b $(BE)
@$(ll) file_done "$@" "Interactive session ended"
###
# ------------ --
include $(MK_SHARE)Core/Main.dirstack-pop.mk
# vim:noet: