-
Notifications
You must be signed in to change notification settings - Fork 1
/
TMakefile
138 lines (115 loc) · 3.17 KB
/
TMakefile
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
param CC gcc
param CFLAGS "-fpic"
param DEBUG "-g -Wno-char-subscripts -O0"
param PREFIX "/usr/local"
param DESTDIR ""
param INSTALLDIR "install -d"
param INSTALLEXE "install -m 755"
param INSTALL "install -m 644"
param OBJSUF .o
param LIBSUF .a
param SOSUF .so
param EXESUF ""
param LIBPREF lib
param RM "rm -f"
param AR ar
param RANLIB ranlib
param LD gcc
param LDFLAGS -shared
param SYSLIBS "-ldl -lm"
param PLATFORM_FEATURES "-DSUN_DL=1"
param FEATURES "$PLATFORM_FEATURES"
set BINTARGET "tiny7$EXESUF"
set LIBTARGET "${LIBPREF}tiny7$SOSUF"
set STATICLIBTARGET "${LIBPREF}tiny7$LIBSUF"
set HSRC {scheme.h dynload.h scheme-private.h opdefines.h}
rule all {$LIBTARGET $STATICLIBTARGET $BINTARGET}
set OBJS [sub .c .o {
global CC CFLAGS DEBUG FEATURES PREFIX
param LIBEXECDIR "$PREFIX/lib/tiny7"
set SRC {}
foreach f $INPUTS {
if {[file extension $f] == ".c"} {
lappend SRC $f
}
}
exec $CC -I. -c -DInitFile=\"$LIBEXECDIR/init.scm\" \
{*}$CFLAGS {*}$DEBUG {*}$FEATURES -o $TARGET {*}$SRC
}]
rule $LIBTARGET $OBJS {
global LD OBJS SYSLIBS
exec $LD -o $TARGET {*}$INPUTS {*}$SYSLIBS
}
rule $BINTARGET $OBJS {
global CC CFLAGS DEBUG SYSLIBS PREFIX
exec $CC -o $TARGET {*}$DEBUG {*}$INPUTS {*}$SYSLIBS
}
rule $STATICLIBTARGET $OBJS {
global AR RANLIB
exec $AR cr $TARGET {*}$INPUTS
exec $RANLIB $TARGET
}
rule scheme.o {scheme.h scheme-private.h opdefines.h}
rule dynload.o {dynload.h}
rule! clean {} {
global RM OBJS BINTARGET LIBTARGET STATICLIBTARGET EXESUF
exec {*}$RM {*}$OBJS $LIBTARGET $STATICLIBTARGET $BINTARGET
exec {*}$RM tinyscheme.ilk tinyscheme.map tinyscheme.pdb tinyscheme.exp
exec {*}$RM scheme.ilk scheme.map scheme.pdb scheme.lib scheme.exp
exec {*}$RM "*~"
}
set TAGS_SRCS {scheme.h scheme.c dynload.h dynload.c}
rule tags {TAGS}
rule TAGS {$TAGS_SRCS} {
exec ctags {*}$INPUTS
}
rule! install {all} {
global BINTARGET STATICLIBTARGET LIBTARGET HSRC
global INSTALL INSTALLDIR INSTALLEXE
global PREFIX DESTDIR LIBEXECDIR
param BINDIR "$PREFIX/bin"
param LIBDIR "$PREFIX/lib"
param LIBEXECDIR "$PREFIX/lib/tiny7"
param INCLUDEDIR "$PREFIX/include/tiny7"
#param MANDIR "$PREFIX/share/man"
param DOCDIR "$PREFIX/share/doc/tiny7"
exec {*}$INSTALLDIR "$DESTDIR/$BINDIR"
exec {*}$INSTALLDIR "$DESTDIR/$LIBDIR"
exec {*}$INSTALLDIR "$DESTDIR/$LIBEXECDIR"
exec {*}$INSTALLDIR "$DESTDIR/$INCLUDEDIR"
#exec {*}$INSTALLDIR "$DESTDIR/$MANDIR"
exec {*}$INSTALLDIR "$DESTDIR/$DOCDIR"
exec {*}$INSTALLEXE $BINTARGET "$DESTDIR/$BINDIR"
exec {*}$INSTALL $STATICLIBTARGET "$DESTDIR/$LIBDIR"
exec {*}$INSTALLEXE $LIBTARGET "$DESTDIR/$LIBDIR"
foreach h $HSRC {
exec {*}$INSTALL $h "$DESTDIR/$INCLUDEDIR"
}
exec {*}$INSTALL init.scm "$DESTDIR/$LIBEXECDIR"
foreach doc {CHANGES COPYING Manual.txt} {
exec {*}$INSTALL $doc "$DESTDIR/$DOCDIR"
}
}
rule pdf {refman.tex} {
set CWD [pwd]
if {![file exists doc]} {
file mkdir doc
}
cd doc
exec pdflatex ../refman.tex
exec makeindex refman.idx
exec pdflatex ../refman.tex
cd $CWD
}
rule html {refman.tex} {
set CWD [pwd]
if {![file exists doc]} {
file mkdir doc
}
cd doc
exec tex2page ../refman.tex
exec makeindex refman.idx
exec tex2page ../refman.tex
exec sed {s@\$hr\$@<hr />@} -i refman.html
cd $CWD
}