summaryrefslogtreecommitdiff
path: root/gnu/lib/libobjc/Makefile.bsd-wrapper
blob: d4f65217804c244258aceffc36b68567c6a2732b (plain)
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#	$OpenBSD: Makefile.bsd-wrapper,v 1.1 2004/01/15 23:45:37 espie Exp $

LIB=		objc


LIBIBERTY_INCLUDES=${.CURDIR}/../libiberty/include
.include <bsd.own.mk>
.if ${USE_GCC3:L} == "yes"
GCCDIR= $(.CURDIR)/../../usr.bin/gcc
GCCSRCDIR=${GCCDIR}/gcc
.else
GCCDIR= $(.CURDIR)/../../egcs/gcc
GCCSRCDIR=${GCCDIR}
.endif

.if defined(OBJMACHINE)
OBJDIR=	obj.${MACHINE}
.else
OBJDIR=	obj
.endif
GCCOBJDIR!=	if [ -d $(GCCDIR)/$(OBJDIR) ]; then \
			echo $(GCCDIR)/$(OBJDIR); \
		else \
			echo $(GCCDIR); \
		fi

GNUCFLAGS=	${CFLAGS} ${COPTS} -DOPENBSD_NATIVE
		

MAKE_FLAGS= 	CFLAGS="${GNUCFLAGS}" \
		CC="${CC}" LDFLAGS="${LDSTATIC}" \
		LIBIBERTY_INCLUDES=${LIBIBERTY_INCLUDES} \
		CPPFLAGS=${CPPFLAGS} \
		GCCSRCDIR=${GCCSRCDIR} \
		GCCOBJDIR=${GCCOBJDIR}

CPPFLAGS+= -I. -I${.CURDIR}/libobjc -I$(.CURDIR)/libobjc/objc  -I$(GCCSRCDIR) \
-I$(GCCSRCDIR)/config  -I$(GCCOBJDIR) -I$(LIBIBERTY_INCLUDES) \
-DIN_GCC

SRCS=archive.c class.c encoding.c gc.c hash.c init.c linking.m misc.c \
nil_method.c NXConstStr.m Object.m objects.c Protocol.m sarray.c  \
selector.c sendmsg.c thr.c 

# XXX need to check how threads work.
SRCS+=thr-single.c

includes:
	install -d -m 755 -o $(BINOWN) -g $(BINGRP) \
		$(DESTDIR)/usr/include/objc
	@-cd $(.CURDIR)/libobjc/objc; for i in *.h; do \
		[ $$i = "runtime.h" ] || install -C -o $(BINOWN) -g $(BINGRP) -m $(NONBINMODE) \
				$$i $(DESTDIR)/usr/include/objc/$$i; \
	done

depend: 
	cd ${GCCDIR} && exec ${MAKE} -f Makefile.bsd-wrapper config.status target_path tconfig.h

sendmsg.o sendmsg.go sendmsg.po sendmsg.so: runtime-info.h

runtime-info.h:
		echo "" > tmp-runtime
		echo "/* This file is automatically generated */" > $@
		`$(CC) -print-prog-name=cc1obj` -print-objc-runtime-info tmp-runtime >> $@
		rm -f tmp-runtime

.ifdef GLOBAL_AUTOCONF_CACHE
CF=	--cache-file=${GLOBAL_AUTOCONF_CACHE}
.else
CF=
.endif

config.status: libobjc/Makefile.in libobjc/configure
	PATH="/bin:/usr/bin:/sbin:/usr/sbin" \
	INSTALL_PROGRAM="${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP}" \
	GCCDIR=${GCCDIR} \
	/bin/sh ${.CURDIR}/libobjc/configure --with-gnu-as --with-gnu-ld \
		--prefix=/usr --mandir='$$(prefix)/share/man' \
		--enable-shared \
		--with-local-prefix=/usr ${CF} \
		&& touch config.status

.ifdef NOMAN
maninstall:
	@echo NOMAN is set
.endif

depend: 

lint:
	# Nothing here so far...

tags:
	# Nothing here so far...

.include <bsd.obj.mk>
.ifndef NOMAN
.include <bsd.man.mk>
.endif
.include <bsd.lib.mk>

.SUFFIXES:	.m

.PATH.c:	${.CURDIR}/libobjc
.PATH.m:	${.CURDIR}/libobjc

COMPILE.m=${COMPILE.c} -fgnu-runtime

gc.o: gc.c
	@echo "${COMPILE.m} ${.ALLSRC} -o ${.TARGET}"
	@${COMPILE.m} ${.ALLSRC}  -o ${.TARGET}.o
	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
	@rm -f ${.TARGET}.o
	
gc.go: gc.c
	@echo "${COMPILE.m} -g ${.ALLSRC} -o ${.TARGET}"
	@${COMPILE.m} -g ${.ALLSRC} -o ${.TARGET}.o
	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
	@rm -f ${.TARGET}.o

gc.po: gc.c
	@echo "${COMPILE.m} -p ${.ALLSRC} -o ${.TARGET}"
	@${COMPILE.m} -p ${.ALLSRC} -o ${.TARGET}.o
	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
	@rm -f ${.TARGET}.o

gc.so: gc.c
	@echo "${COMPILE.m} ${PICFLAG} -DPIC ${.ALLSRC} -o ${.TARGET}"
	@${COMPILE.m} ${PICFLAG} -DPIC ${.ALLSRC} -o ${.TARGET}.o
	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
	@rm -f ${.TARGET}.o

.m.o:
	@echo "${COMPILE.m} ${.IMPSRC} -o ${.TARGET}"
	@${COMPILE.m} ${.IMPSRC}  -o ${.TARGET}.o
	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
	@rm -f ${.TARGET}.o

.m.go:
	@echo "${COMPILE.m} -g ${.IMPSRC} -o ${.TARGET}"
	@${COMPILE.m} -g ${.IMPSRC} -o ${.TARGET}.o
	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
	@rm -f ${.TARGET}.o

.m.po:
	@echo "${COMPILE.m} -p ${.IMPSRC} -o ${.TARGET}"
	@${COMPILE.m} -p ${.IMPSRC} -o ${.TARGET}.o
	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
	@rm -f ${.TARGET}.o

.m.so:
	@echo "${COMPILE.m} ${PICFLAG} -DPIC ${.IMPSRC} -o ${.TARGET}"
	@${COMPILE.m} ${PICFLAG} -DPIC ${.IMPSRC} -o ${.TARGET}.o
	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
	@rm -f ${.TARGET}.o