1 | # -*- Makefile -*-
|
---|
2 | # NOTE: this file requires GNU Make.
|
---|
3 | #
|
---|
4 | #PLAT = unix
|
---|
5 | #PRIV = install-private-headers
|
---|
6 | #
|
---|
7 | # Linux:
|
---|
8 | #LDFLAGS = -L/usr/X11R6/lib -lX11 -ldl -lm # -lpthread
|
---|
9 | #
|
---|
10 | # Mac OS X:
|
---|
11 | #LDFLAGS = -framework CoreFoundation -L/usr/X11R6/lib -lX11 -weak-lXss -lXext
|
---|
12 | #LDFLAGS = -framework CoreFoundation -framework Carbon -framework IOKit
|
---|
13 | #LDSTRIP = -x
|
---|
14 |
|
---|
15 | EXTDIR = ../../../../8.x
|
---|
16 | STATIC = --disable-shared --enable-static
|
---|
17 | OUTDIR = $(shell pwd)/build
|
---|
18 | OBJ = $(OUTDIR)/zvfs$O $(OUTDIR)/zlib$O $(OUTDIR)/usb$O \
|
---|
19 | $(OUTDIR)/g2lite$O $(OUTDIR)/swt$O $(OUTDIR)/csr_test$O
|
---|
20 | GUIOBJ ?= $(OBJ) $(OUTDIR)/tclAppInit$O
|
---|
21 | TCLDIR = --with-tcl=$(OUTDIR)/lib --prefix=$(OUTDIR) --exec-prefix=$(OUTDIR)
|
---|
22 | STRIP ?= strip
|
---|
23 | UPX ?= :
|
---|
24 | O ?=.o
|
---|
25 | A ?=.a
|
---|
26 | SO ?=.so
|
---|
27 |
|
---|
28 | BLT_OPTS = --disable-threads
|
---|
29 | TKTABLE_OPTS = --disable-threads
|
---|
30 | VFS_OPTS = --disable-threads
|
---|
31 | TDOM_OPTS = --disable-threads
|
---|
32 | TCLX_OPTS = --disable-threads
|
---|
33 | XOTCL_OPTS = --disable-threads
|
---|
34 | SQLITE_OPTS = --disable-threads
|
---|
35 | ZLIB_OPTS = --prefix=$(OUTDIR)
|
---|
36 | LIBUSB_OPTS = --prefix=$(OUTDIR)
|
---|
37 |
|
---|
38 | tclkit-gui$(EXE): kit-gui$(EXE) ../../setupvfs.tcl build/files
|
---|
39 | cp kit-gui$(EXE) $@
|
---|
40 | sleep 3
|
---|
41 | $(STRIP) $@
|
---|
42 | $(UPX) $@
|
---|
43 | ./kit-gui -init- ../../setupvfs.tcl $(KIT_OPTS) $@ gui
|
---|
44 |
|
---|
45 | ifeq ($(PLAT), win)
|
---|
46 | kit-gui$(EXE): build/tcl build/tk build/blt build/Tktable build/tclvfs build/zlib \
|
---|
47 | build/tdom build/tcllib build/xotcl build/sqlite build/libusb-win32 $(GUIOBJ)
|
---|
48 | $(CC) -o $@ $(CFLAGS) ../../kitInit.c $(GUIOBJ) \
|
---|
49 | -Ibuild/include -DKIT_LITE -DSTATIC_BUILD \
|
---|
50 | build/lib/vfs1*/*vfs1*$A \
|
---|
51 | -DKIT_INCLUDES_TK build/lib/*tk8*$A \
|
---|
52 | build/lib/libz$A build/lib/libusb$A \
|
---|
53 | build/lib/*tcl8*$A \
|
---|
54 | build/lib/BLT2*/*BLT2*$A \
|
---|
55 | build/lib/Tktable2*/*Tktable2*$A \
|
---|
56 | build/lib/tdom0*/*tdom0*$A \
|
---|
57 | build/lib/sqlite3*/*sqlite3*$A \
|
---|
58 | build/lib/xotcl1*/*xotcl1*$A \
|
---|
59 | $(LDFLAGS) $(GUI_OPTS)
|
---|
60 | else
|
---|
61 | kit-gui$(EXE): build/tcl build/tk build/blt build/Tktable build/tclvfs build/zlib \
|
---|
62 | build/tdom build/tcllib build/xotcl build/sqlite build/libusb $(GUIOBJ)
|
---|
63 | $(CC) -o $@ $(CFLAGS) ../../kitInit.c $(GUIOBJ) \
|
---|
64 | -Ibuild/include -DKIT_LITE -DSTATIC_BUILD \
|
---|
65 | build/lib/vfs1*/*vfs1*$A \
|
---|
66 | -DKIT_INCLUDES_TK build/lib/*tk8*$A \
|
---|
67 | build/lib/libz$A build/lib/libusb$A \
|
---|
68 | build/lib/*tcl8*$A \
|
---|
69 | build/lib/BLT2*/*BLT2*$A \
|
---|
70 | build/lib/Tktable2*/*Tktable2*$A \
|
---|
71 | build/lib/tdom0*/*tdom0*$A \
|
---|
72 | build/lib/sqlite3*/*sqlite3*$A \
|
---|
73 | build/lib/xotcl1*/*xotcl1*$A \
|
---|
74 | $(LDFLAGS) $(GUI_OPTS)
|
---|
75 | endif
|
---|
76 |
|
---|
77 | build/files:
|
---|
78 | mkdir -p $@ && cd $@ && ln -s ../../../../files/* .
|
---|
79 |
|
---|
80 | build/tcl:
|
---|
81 | mkdir -p $@ && cd $@ && CFLAGS="$(CFLAGS)" && export CFLAGS && \
|
---|
82 | sh ../../../tcl/$(PLAT)/configure $(STATIC) $(TCL_OPTS) \
|
---|
83 | --prefix=$(OUTDIR) --exec-prefix=$(OUTDIR) && \
|
---|
84 | $(MAKE) install-binaries install-libraries $(PRIV)
|
---|
85 |
|
---|
86 | build/tk: build/tcl
|
---|
87 | mkdir -p $@ && cd $@ && CFLAGS="$(CFLAGS)" && export CFLAGS && \
|
---|
88 | sh ../../../tk/$(PLAT)/configure $(STATIC) $(TCLDIR) $(TK_OPTS) && \
|
---|
89 | $(MAKE) install-binaries install-libraries $(PRIV)
|
---|
90 |
|
---|
91 | build/blt: build/tk
|
---|
92 | mkdir -p $@ && cd $@ && CFLAGS="$(CFLAGS)" && export CFLAGS && \
|
---|
93 | sh $(EXTDIR)/blt/configure $(STATIC) $(TCLDIR) $(BLT_OPTS) && \
|
---|
94 | $(MAKE) install-binaries install-libraries
|
---|
95 |
|
---|
96 | build/Tktable: build/tk
|
---|
97 | mkdir -p $@ && cd $@ && CFLAGS="$(CFLAGS)" && export CFLAGS && \
|
---|
98 | sh $(EXTDIR)/Tktable/configure $(STATIC) $(TCLDIR) $(TKTABLE_OPTS) && \
|
---|
99 | $(MAKE) install-binaries install-libraries
|
---|
100 |
|
---|
101 | build/tclvfs: build/tcl
|
---|
102 | mkdir -p $@ && cd $@ && CFLAGS="$(CFLAGS)" && export CFLAGS && \
|
---|
103 | sh $(EXTDIR)/tclvfs/configure $(STATIC) $(TCLDIR) $(VFS_OPTS) && \
|
---|
104 | $(MAKE) install
|
---|
105 |
|
---|
106 | build/zlib: build/tcl
|
---|
107 | cp -R ../../8.x/zlib/. $@
|
---|
108 | cd $@ && CFLAGS="$(CFLAGS)" && export CFLAGS && \
|
---|
109 | sh $(EXTDIR)/zlib/configure $(ZLIB_OPTS) && \
|
---|
110 | $(MAKE) install
|
---|
111 |
|
---|
112 | build/libusb-win32: build/tcl
|
---|
113 | cp -R ../../8.x/libusb-win32/. $@
|
---|
114 | cd $@ && $(MAKE) && cp libusb.a ../lib/ && cp lusb0_usb.h ../include/usb.h
|
---|
115 |
|
---|
116 | build/libusb: build/tcl
|
---|
117 | cp -R ../../8.x/libusb/. $@
|
---|
118 | cd $@ && CFLAGS="$(CFLAGS)" && export CFLAGS && \
|
---|
119 | sh configure $(LIBUSB_OPTS) && \
|
---|
120 | $(MAKE) && $(MAKE) install
|
---|
121 |
|
---|
122 | build/tdom: build/tcl
|
---|
123 | mkdir -p $@ && cd $@ && CFLAGS="$(CFLAGS)" && export CFLAGS && \
|
---|
124 | sh $(EXTDIR)/tdom/configure $(STATIC) $(TCLDIR) $(TDOM_OPTS) && \
|
---|
125 | $(MAKE) install
|
---|
126 |
|
---|
127 | build/tcllib: build/tcl
|
---|
128 | mkdir -p $@ && cd $@ && CFLAGS="$(CFLAGS)" && export CFLAGS && \
|
---|
129 | sh $(EXTDIR)/tcllib/configure $(STATIC) $(TCLDIR) $(TCLLIB_OPTS) && \
|
---|
130 | $(MAKE) install-libraries
|
---|
131 |
|
---|
132 | build/xotcl: build/tcl
|
---|
133 | mkdir -p $@ && cd $@ && CFLAGS="$(CFLAGS)" && export CFLAGS && \
|
---|
134 | sh $(EXTDIR)/xotcl/configure $(STATIC) $(TCLDIR) $(XOTCL_OPTS) && \
|
---|
135 | $(MAKE) install-binaries
|
---|
136 |
|
---|
137 | build/sqlite: build/tcl
|
---|
138 | mkdir -p $@ && cd $@ && CFLAGS="$(CFLAGS)" && export CFLAGS && \
|
---|
139 | sh $(EXTDIR)/sqlite/tea/configure $(STATIC) $(TCLDIR) $(SQLITE_OPTS) && \
|
---|
140 | $(MAKE) install-binaries
|
---|
141 |
|
---|
142 | base: build/tcl build/tk
|
---|
143 | ls -l build/bin
|
---|
144 |
|
---|
145 | tidy: cleanext
|
---|
146 | rm -rf build/tcl build/tk build/tkdyn
|
---|
147 |
|
---|
148 | cleanext:
|
---|
149 | rm -rf build/tclvfs build/thread build/zlib build/*.o
|
---|
150 | rm -rf build/lib/vfs* build/lib/thread*
|
---|
151 |
|
---|
152 | clean:
|
---|
153 | rm -rf build kit-gui$(EXE)
|
---|
154 |
|
---|
155 | distclean: clean
|
---|
156 | rm -f tclkit-gui$(EXE)
|
---|
157 |
|
---|
158 | .PHONY: all base clean distclean threaded tidy
|
---|
159 |
|
---|
160 | $(OUTDIR)/zvfs$O: ../../zvfs.c
|
---|
161 | $(CC) -o $@ $(CFLAGS) -DSTDC_HEADERS=1 -DHAVE_UNISTD_H=1 -DSTATIC_BUILD -Ibuild/include -c $<
|
---|
162 |
|
---|
163 | $(OUTDIR)/zlib$O: ../../zlib.c
|
---|
164 | $(CC) -o $@ $(CFLAGS) -DSTATIC_BUILD -Ibuild/include -c $<
|
---|
165 |
|
---|
166 | $(OUTDIR)/g2lite$O: ../../g2lite.c
|
---|
167 | $(CC) -o $@ $(CFLAGS) -DSTATIC_BUILD -Ibuild/include -c $<
|
---|
168 |
|
---|
169 | $(OUTDIR)/usb$O: ../../usb.c
|
---|
170 | $(CC) -o $@ $(CFLAGS) -DSTATIC_BUILD -Ibuild/include -c $<
|
---|
171 |
|
---|
172 | $(OUTDIR)/swt$O: ../../swt.c
|
---|
173 | $(CC) -o $@ $(CFLAGS) -DSTATIC_BUILD -Ibuild/include -c $<
|
---|
174 |
|
---|
175 | $(OUTDIR)/csr_test$O: ../../csr_test.c
|
---|
176 | $(CC) -o $@ $(CFLAGS) -DSTATIC_BUILD -Ibuild/include -c $<
|
---|
177 |
|
---|
178 | $(OUTDIR)/tclAppInit$O: ../tcl/$(PLAT)/tclAppInit.c
|
---|
179 | $(CC) -o $@ $(CFLAGS) -DSTATIC_BUILD -Ibuild/include \
|
---|
180 | -DTCL_LOCAL_APPINIT=TclKit_AppInit -c $<
|
---|
181 |
|
---|
182 | $(OUTDIR)/winMain$O: ../tk/$(PLAT)/winMain.c
|
---|
183 | $(CC) -o $@ $(CFLAGS) -DSTATIC_BUILD -Ibuild/include \
|
---|
184 | -DTK_LOCAL_APPINIT=TclKit_AppInit -c $<
|
---|
185 |
|
---|
186 | $(OUTDIR)/tclkit.res.o: ../../tclkit.rc
|
---|
187 | cp $< build/tk/tclkit.rc
|
---|
188 | windres -o $@ --define STATIC_BUILD --define TCLKIT_WITH_TK \
|
---|
189 | --define BASE_NO_TK_ICON --include build/include \
|
---|
190 | --include build/tk --include ../../files --include ../tk/win/rc \
|
---|
191 | build/tk/tclkit.rc
|
---|
192 |
|
---|
193 | $(OUTDIR)/tclkitsh.res.o: ../../tclkit.rc
|
---|
194 | windres -o $@ --define STATIC_BUILD --include build/include \
|
---|
195 | --include ../../files $<
|
---|