The gorilla example was great, but it rebuilds the whole shebang every time. I was looking for a Makefile that would let me make local changes, rebuild, and test before checking the source back in. Another difference is that this depends on the local Tcl installation more for it's packages. Updated to build for windows and linux platforms with a command line define. All my builds are on my windows box, but changing that is trivial. $make ARCH=LINUX will build for my particular linux host. Since I don't need binary extensions, I can use the same tcllib and other pure tcl libraries, which means that LINTCLLIB and WINTCLLIB can be the same. Otherwise, you'd need to install a parallel set of binaries for the 'other' platform. WINTCLBIN = c:/usr/share/Tcl/bin WINTCLLIB = c:/usr/share/Tcl/lib LINTCLLIB = c:/usr/share/Tcl/lib WINKIT = $(WINTCLBIN)/tclkitsh-win32.upx.exe WINSDX = $(WINTCLBIN)/tclsh.exe $(WINTCLBIN)/sdx.kit LINKIT = $(LINTCLBIN)/tclkit-linux-x86.upx.bin ifndef ARCH ARCH = WIN endif ifeq ($(ARCH),WIN) LIBTCL = $(WINTCLLIB) KIT = $(WINKIT) SDX = $(WINSDX) APPEXT = .exe else ifeq ($(ARCH),LINUX) LIBTCL = $(LINTCLLIB) KIT = $(LINKIT) SDX = $(WINSDX) APPEXT = endif endif TCLLIB = $(WINTCLLIB)/tcllib1.8 Up to here, I'm just getting the local Tcl installation set up. Below gets the tcl packages set up. TCLLIBS = aes sha1 crc SimpleDevLibLoc = $(LIBTCL)/SimpleDevLib-1.0 These are packages I'm using that have various naming idiosyncracies. Next, common starkit/starpack stuff. APP = wsem VFS = $(APP).vfs KIT_LIB = $(VFS)/lib KIT_APP = $(VFS)/lib/app-$(APP)/$(APP).tcl The section above should be common for any starkit or starpack, just replace your app name. PACKAGES = $(TCLLIBS) SimpleDevLib winserv CONFIGS = $(VFS)/wifi.cfg $(VFS)/cdma.cfg SERVERCFG = wifi.cfg TESTS = $(VFS)/upgrade.test DEFTEST = upgrade.test Other stuff that I want in the starkit is above. Now the rules (fixed some dependencies.) These rules make the starkit depend on all the files that go into it, as well as the .vfs directory at the root, and make the starpack depend on the kit. all: $(APP)$(APPEXT) kit: $(APP).kit $(APP)$(APPEXT): $(APP).kit $(SDX) wrap $@ -runtime $(KIT) $(APP).kit: $(VFS) $(KIT_APP) $(PACKAGES) $(CONFIGS) $(TESTS) touch $@ $(VFS): if [ ! -d $(APP).vfs ]; \ then $(SDX) qwrap $(APP).tcl; $(SDX) unwrap $(APP).kit; fi $(KIT_APP): $(APP).tcl cp -f $< $@ The rules up to this point should be fairly common. Every starkit starts with one .tcl file to base the kit on. The Makefile is in the same directory as .tcl. If you edit .tcl and run Make the starkit / starpack will be rebuilt. $(CONFIGS):$(VFS)/%:% cp -f $< $@; \ if [ $< == $(SERVERCFG) ]; then \ cp -f $< $(VFS)/server.cfg; fi; \ $(TESTS):$(VFS)/%:% cp -f $< $@; \ if [ $< == $(DEFTEST) ]; then \ cp -f $< $(VFS)/test.test; fi; \ The two rules above are static pattern rules that make the files in the vfs dependent on the files of the same name in the current directory, so if you change any of these files, the starkit will be rebuilt. As an example: if wifi.cfg is newer than wsem.vfs/wifi.cfg then copy wifi.cfg to the root of the vfs. # put packages here, they each have different idiosyncracies All of the rules below simply copy entire packages from the local tcl lib into the vfs lib. Since I'm using only small parts of tcllib, I flatten it out in the starkit. SimpleDevLib: if [ ! -d $(KIT_LIB)/$@ ] ; then \ mkdir $(KIT_LIB)/$@ ; \ cp $(SimpleDevLibLoc)/*.tcl $(KIT_LIB)/$@; \ fi winserv: if [ ! -d $(KIT_LIB)/$@ ] ; then \ mkdir $(KIT_LIB)/$@ ; \ cp $(LIBTCL)/$@/* $(KIT_LIB)/$@; \ fi # put packages from tcllib here aes: if [ ! -d $(KIT_LIB)/$@ ] ; then \ mkdir $(KIT_LIB)/$@ ; \ for f in pkgIndex aes; do \ cp $(TCLLIB)/$(@)/$$f.tcl $(KIT_LIB)/$@; done \ fi sha1: if [ ! -d $(KIT_LIB)/$@ ] ; then \ mkdir $(KIT_LIB)/$@ ; \ for f in pkgIndex sha1 sha1 sha256; do \ cp $(TCLLIB)/$(@)/$$f.tcl $(KIT_LIB)/$@; done \ fi crc: if [ ! -d $(KIT_LIB)/$@ ] ; then \ mkdir $(KIT_LIB)/$@ ; \ for f in pkgIndex cksum crc16 crc32 crcc sum; do \ cp $(TCLLIB)/$(@)/$$f.tcl $(KIT_LIB)/$@; done \ fi clean: rm -f $(APP).kit $(APP).exe rm -rf $(VFS) ---- [Category Example]