aboutsummaryrefslogtreecommitdiffstats
path: root/lang/schemetoc/files/patch-af
blob: 65605e44f15b0054826d6fd5ff7e0d84bd3b45d7 (plain) (blame)
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
--- scrt/makefile.orig  Wed Feb 17 10:55:48 1993
+++ scrt/makefile   Wed Feb  2 22:22:22 2000
@@ -5,7 +5,9 @@
 #
 
 .SUFFIXES:
-.SUFFIXES: .o .c .sc .s
+.SUFFIXES: .o .c .sc .s .so
+
+SOVER = 1
 
 SCC = ../scsc/scc
 SCCFLAGS = 
@@ -14,6 +16,8 @@
 
 Cruntime = scinit.o apply.o callcc.o cio.o heap.o objects.o mtraps.o
 
+SCruntime = scinit.so apply.so callcc.so cio.so heap.so objects.so mtraps.so
+
 Cruntimec = scinit.c apply.c callcc.c cio.c heap.c objects.c mtraps.c
 
 Chfiles = scinit.h apply.h callcc.h cio.h heap.h objects.h options.h
@@ -22,6 +26,11 @@
       scqquote.o screp.o \
       scrt1.o scrt2.o scrt3.o scrt4.o scrt5.o scrt6.o scrt7.o scrtuser.o
 
+SSruntime = scdebug.so sceval.so scexpand.so scexpnd1.so scexpnd2.so \
+      scqquote.so screp.so \
+      scrt1.so scrt2.so scrt3.so scrt4.so scrt5.so scrt6.so scrt7.so \
+      scrtuser.so
+
 Sruntimec = scdebug.c sceval.c scexpand.c scexpnd1.c scexpnd2.c \
             scqquote.c screp.c \
             scrt1.c scrt2.c scrt3.c scrt4.c scrt5.c scrt6.c scrt7.c scrtuser.c
@@ -43,17 +52,27 @@
    ${SCC} -C ${SCCFLAGS} $*.sc
 
 .c.o:
-   ${CC} -c ${CFLAGS} -I. $*.c
+   ${CC} ${CFLAGS} -c ${.IMPSRC} -I. -o ${.TARGET}
+
+.c.so: 
+   ${CC} ${PICFLAGS} ${CFLAGS} -c ${.IMPSRC} -I. -o ${.TARGET}
 
 .s.o:
    ${CC} -c $*.s
 
+.s.so:
+   ${CPP} -E -DPIC ${CFLAGS:M-[ID]*} ${.IMPSRC} | \
+       ${AS} -k -o ${.TARGET}
+
 sc-to-c:   ${Sruntimec} sci.c
 
 c-to-o:        ${Sruntimec} ${Sruntime} ${Cruntime}
 
 s-to-o:        ${Aruntime}
 
+OBJS = ${Sruntime} ${Cruntime} ${Aruntime}
+SHAREDOBJS = ${OBJS:.o=.so}
+
 Xlibsc.a:  ${Sruntimec} ${Sruntime} ${Cruntime} ${Aruntime}
    rm -f Xlibsc.a
    ar q Xlibsc.a ${Cruntime} ${Sruntime} ${Aruntime}
@@ -75,36 +94,42 @@
 Xmv:       Xsci Xlibsc.a
    mv Xsci sci
    mv Xlibsc.a libsc.a
-   
+
 port:
-   make "CC = ${CC}" "CFLAGS = ${CFLAGS}" "SCC = echo" \
-        Xlibsc.a Xsci Xmv ${Plib}
+   ${MAKE} "CC = ${CC}" "CFLAGS = ${CFLAGS}" "SCC = echo" \
+        Xlibsc.a Xsci Xmv ${Plib} libsc.so.${SOVER}
 
 libsc_p.a: libsc.a
    mkdir saveobj
    mv ${Sruntime} ${Cruntime} ${Aruntime} saveobj
    rm -f libsc_p.a
-   make "CC = ${CC}" "CFLAGS = ${CFLAGS} -pg" ${Sruntime} ${Cruntime} \
+   ${MAKE} "CC = ${CC}" "CFLAGS = ${CFLAGS} -pg" ${Sruntime} ${Cruntime} \
         ${Aruntime}
    ar q libsc_p.a ${Cruntime} ${Sruntime} ${Aruntime}
    ${RANLIB} libsc_p.a
    mv saveobj/* .
    rmdir saveobj
 
+libsc.so.${SOVER}: ${SCruntime} ${SSruntime} ${SAruntime}
+   rm -f libsc.so.${SOVER}
+   ${CC} -shared  -Wl,-x -Wl,-assert -Wl,pure-text -Wl,-soname,$@ -o $@ \
+       ${SCruntime} ${SSruntime} ${SAruntime}
+
 install-private:
-   make "LIBDIR = ${DESTDIR}" "BINDIR = ${DESTDIR}" \
+   ${MAKE} "LIBDIR = ${DESTDIR}" "BINDIR = ${DESTDIR}" \
         "OWNER = -o `whoami`" install
 
 install:
-   -mkdir ${LIBDIR}/schemetoc
-   cp libsc.a ${LIBDIR}/schemetoc/libsc.a
-   ${RANLIB} ${LIBDIR}/schemetoc/libsc.a
-   -cp libsc_p.a ${LIBDIR}/schemetoc/libsc_p.a
-   -${RANLIB} ${LIBDIR}/schemetoc/libsc_p.a
-   cp objects.h ${LIBDIR}/schemetoc
-   cp options.h ${LIBDIR}/schemetoc
-   cp predef.sc ${LIBDIR}/schemetoc
-   cp sci ${BINDIR}/sci
+   ${BSD_INSTALL_DATA} libsc.a ${LIBDIR}
+   -${RANLIB} ${LIBDIR}/libsc.a
+   ${BSD_INSTALL_DATA} libsc_p.a ${LIBDIR}
+   -${RANLIB} ${LIBDIR}/libsc_p.a
+   ${BSD_INSTALL_DATA} objects.h ${LIBDIR}/schemetoc
+   ${BSD_INSTALL_DATA} options.h ${LIBDIR}/schemetoc
+   ${BSD_INSTALL_DATA} predef.sc ${LIBDIR}/schemetoc
+   ${BSD_INSTALL_PROGRAM} sci ${BINDIR}
+   ${BSD_INSTALL_DATA} libsc.so.${SOVER} ${LIBDIR}
+   ln -sf libsc.so.${SOVER} ${LIBDIR}/libsc.so
 
 clean:
    rm -f ${Sruntime} ${Cruntime} ${Aruntime} sci.o embedded.o \
@@ -124,8 +149,8 @@
          libsc.a ${Plib} sci ${destdir}
 
 all:
-   make "CC = ${CC}" "CFLAGS = ${CFLAGS}" "SCC = ${SCC}" \
-        "SCCFLAGS = ${SCCFLAGS}" Xlibsc.a Xsci Xmv ${Plib}
+   ${MAKE} "CC = ${CC}" "CFLAGS = ${CFLAGS}" "SCC = ${SCC}" \
+        "SCCFLAGS = ${SCCFLAGS}" Xlibsc.a Xsci Xmv ${Plib} libsc.so.${SOVER}
 
 srclinks:
    for x in ${Cruntimec} ${Chfiles} ${Sruntimec} ${Sruntimesc} ${Smisc}; \