1## WARNING: This makefile is designed to be used only from the master
2## makefile in the parent directory.
3
4#_______________________________________________________________________
5#
6# How this makefile works.
7#
8# This makefile builds four libraries.  Two are based directly on
9# Tk/Tcl.  The other two are an interface between Scheme, X and
10# Tk/Tcl.
11#
12# The build process works by customizing an off-the-shelf version of tk
13# (currently version 3.2).  The SWAT versions of some of the files are
14# copied over the off-the-shelf version.  The customized version is
15# compiled to produce the libtk.a and libtcl.a libraries.  These
16# libraries are not acutally used but they ensure that all the targets
17# that we are interested in are up to date.  Then we construct our own
18# libraries (tk.sl and tcl.sl).
19#
20# The other libraries are more straight-forward.
21#_______________________________________________________________________
22
23# The location of the customized files.  The directory structure matches
24# that of tk3.2 and is sparsely populated with customized files:
25
26CUSTOM = tk3.2-custom
27
28# Important: select a microcode source directory with the correct scheme
29# object representation:
30
31SCHEME_INCLUDE_DIRS =  -I/scheme/8.0/src/microcode
32
33TK =        tk3.2
34TCL =       $(TK)/tcl
35
36#UITK_INCLUDE_DIRS = -I $(UITK) -I $(UITK_C) -I $(TK) -I $(TCL) $(SCHEME_INCLUDE_DIRS)
37UITK_INCLUDE_DIRS = -I $(TK) -I $(TCL) $(SCHEME_INCLUDE_DIRS)
38CFLAGS = -DMIT_SCHEME -O  -Ae -D_HPUX -I/usr/include/X11R5 +z
39
40XLIB		= -L /usr/lib/X11R5 -lX11
41
42# These library paths are overruled by the master makefile.
43
44#TK_LIBRARY	= /scheme/8.0/700/swat/c/tk3.2/library
45#TCL_LIBRARY	= /scheme/8.0/700/swat/c/tk3.2/tcl/library
46TK_LIBRARY	= Built_incorrectly__TK_LIBRARY__not_specified
47TCL_LIBRARY	= Built_incorrectly__TCL_LIBRARY__not_specified
48
49TCL_GENERIC_OBJS = \
50	$(TCL)/regexp.o     $(TCL)/tclAssem.o   $(TCL)/tclBasic.o \
51	$(TCL)/tclCkalloc.o $(TCL)/tclCmdAH.o   $(TCL)/tclCmdIL.o \
52	$(TCL)/tclCmdMZ.o   $(TCL)/tclExpr.o    $(TCL)/tclGet.o \
53	$(TCL)/tclHash.o    $(TCL)/tclHistory.o $(TCL)/tclParse.o \
54	$(TCL)/tclProc.o    $(TCL)/tclUtil.o    $(TCL)/tclVar.o
55
56TCL_UNIX_OBJS = \
57        $(TCL)/panic.o $(TCL)/tclEnv.o $(TCL)/tclGlob.o $(TCL)/tclUnixAZ.o \
58	$(TCL)/tclUnixStr.o $(TCL)/tclUnixUtil.o
59
60TCL_OBJS = $(TCL_GENERIC_OBJS) $(TCL_UNIX_OBJS) MITScheme.o
61
62TK_WIDGOBJS = \
63	$(TK)/tkButton.o $(TK)/tkEntry.o    $(TK)/tkFrame.o $(TK)/tkListbox.o \
64	$(TK)/tkMenu.o $(TK)/tkMenubutton.o $(TK)/tkMessage.o $(TK)/tkScale.o \
65	$(TK)/tkScrollbar.o
66
67TK_CANVOBJS = \
68	$(TK)/tkCanvas.o   $(TK)/tkCanvArc.o  $(TK)/tkCanvBmap.o \
69	$(TK)/tkCanvLine.o $(TK)/tkCanvPoly.o $(TK)/tkCanvPs.o \
70	$(TK)/tkCanvText.o $(TK)/tkCanvWind.o $(TK)/tkRectOval.o $(TK)/tkTrig.o
71
72TK_TEXTOBJS = $(TK)/tkText.o $(TK)/tkTextBTree.o $(TK)/tkTextDisp.o \
73	$(TK)/tkTextIndex.o $(TK)/tkTextTag.o
74
75TK_OBJS = \
76	$(TK)/tk3d.o     $(TK)/tkArgv.o  $(TK)/tkAtom.o  $(TK)/tkBind.o \
77	$(TK)/tkBitmap.o $(TK)/tkCmds.o  $(TK)/tkColor.o $(TK)/tkConfig.o \
78	$(TK)/tkCursor.o $(TK)/tkError.o $(TK)/tkEvent.o $(TK)/tkFocus.o \
79	$(TK)/tkFont.o   $(TK)/tkGet.o   $(TK)/tkGC.o    $(TK)/tkGeometry.o \
80	$(TK)/tkGrab.o   $(TK)/tkOption.o $(TK)/tkPack.o $(TK)/tkPlace.o \
81	$(TK)/tkPreserve.o $(TK)/tkSelect.o $(TK)/tkSend.o $(TK)/tkWindow.o \
82	$(TK)/tkWm.o $(TK_WIDGOBJS) $(TK_CANVOBJS) $(TK_TEXTOBJS) MITScheme.o
83
84UITK_OBJS = tk-c.o tk-c-mit.o widget-c.o widget-c-mit.o uitk-prims.o
85SCXL_OBJS = scxl.o
86
87# Contents of custom directory structure:
88
89CUSTOM_SRC = \
90	$(CUSTOM)/Makefile \
91	$(CUSTOM)/tkEvent.c $(CUSTOM)/tkWindow.c \
92	$(CUSTOM)/tcl/Makefile $(CUSTOM)/tcl/tclUnix.h \
93	$(CUSTOM)/library/emacs.tcl
94
95all:  scxl.sl tcl.sl tk.sl uitk.sl
96
97scxl.sl: $(SCXL_OBJS)
98	rm -f scxl.sl
99	ld -b -o scxl.sl  $(SCXL_OBJS) $(XLIB) -lc
100
101tcl.sl: $(TCL)/libtcl.a MITScheme.o
102	rm -f tcl.sl
103	ld -b -o tcl.sl  $(TCL_OBJS) -lc
104
105tk.sl: $(TK)/libtk.a MITScheme.o
106	rm -f tk.sl
107	ld -b -o tk.sl  $(TK_OBJS) $(XLIB) -lm -lc
108
109uitk.sl: $(UITK_OBJS)
110	rm -f uitk.sl
111	ld -b -o uitk.sl  $(UITK_OBJS) -lm -lc
112
113scxl.o MITScheme.o uitk-prims.o:
114	$(CC) $(CFLAGS) $(SCHEME_INCLUDE_DIRS) -c $*.c
115
116MITScheme.o: MITScheme.c
117scxl.o: scxl.c
118uitk-prims.o: uitk-prims.c
119
120widget-c.o widget-c-mit.o tk-c-mit.o: $(TK)/tkInt.h $(TK)/default.h
121	$(CC) $(CFLAGS) $(UITK_INCLUDE_DIRS) -c $*.c
122
123tk-c.o: tk-c.c $(TK)/tkInt.h $(TK)/default.h
124	$(CC) $(CFLAGS) $(UITK_INCLUDE_DIRS) TK_LIBRARY=$(TK_LIBRARY) \
125		TCL_LIBRARY=$(TCL_LIBRARY) -c $*.c
126widegt-c.o: widget-c.c
127widget-c-mit.o: widget-c-mit.c
128tk-c-mit.o: tk-c-mit.c
129
130#$(TCL_OBJS) $(TK_OBJS): customization
131$(TCL)/libtcl.a $(TK)/libtk.a: customization
132
133customization: $(CUSTOM_SRC)
134	(cd $(TCL); ./config)
135	# overwrite standard code with customized files
136	cp -f -R tk3.2-custom/* tk3.2
137	rm -f $(TK)/libtk.a $(TCL)/libtcl.a
138	(cd tk3.2; \
139	 make -f Makefile TCL_LIBRARY=$(TCL_LIBRARY) TK_LIBRARY=$(TK_LIBRARY) \
140                 libtk.a tcl/libtcl.a \
141	)
142	date > customization
143
144
145