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
|
--- Makefile.orig Wed Feb 17 09:55:20 1999
+++ Makefile Wed Sep 8 09:35:39 1999
@@ -1,23 +1,25 @@
# $Id: Makefile,v 1.38 1998/10/15 14:15:09 bde Exp $
-PROG = m3gdb
+PROG= m3gdb
-GDBDIR= ${.CURDIR}/../../../../contrib/gdb
-.if ${OBJFORMAT} == elf
-BFDDIR= ${.CURDIR}/../../binutils/libbfd/${MACHINE_ARCH}
-BINDIR= /usr/local/bin
+FBSDGDBDIR= ${.CURDIR}/src/gnu/usr.bin/gdb/gdb
+
+GDBDIR= ${FBSDGDBDIR}/../../../../contrib/gdb
+
+.if ${PORTOBJFORMAT} == elf
+BFDDIR= ${FBSDGDBDIR}/../../binutils/libbfd/${MACHINE_ARCH}
.else
-BFDDIR= ${.CURDIR}/../bfd
-BINDIR= /usr/local/bin/aout
+BFDDIR= ${FBSDGDBDIR}/../bfd
.endif
-MANDIR= /usr/local/man/man
-FBSDGDB=${.CURDIR}/../gdb
-.PATH: ${FBSDGDB}
+BINDIR= ${PREFIX}/bin
+MANDIR= ${PREFIX}/man/man
+
+.PATH: ${FBSDGDBDIR}
.PATH: ${GDBDIR}/gdb
.PATH: ${GDBDIR}/opcodes
-.if ${OBJFORMAT} == elf
+.if ${PORTOBJFORMAT} == elf
CFLAGS+= -DFREEBSD_ELF
.endif
CFLAGS+= -DNEED_DECLARATION_FREE
@@ -50,6 +52,9 @@
m3-lang.c m3-token.c m3-uid.c
SRCS= init.c ${XSRCS}
+.PHONY: show check libdepend libbuild beforedepend afterdepend
+.PHONY: links localclean
+
show:
@echo ${XSRCS}
@@ -60,7 +65,34 @@
@cd ${.CURDIR} && wc *-files
@echo ""
-beforedepend:
+beforedepend: libdepend
+#afterdepend: libbuild # too ugly, call it explicitly in pre-build
+
+.if ${PORTOBJFORMAT} == elf
+LIBBFDDIR= ${FBSDGDBDIR}/../../binutils/libbfd
+LIBIBERTYDIR= ${FBSDGDBDIR}/../../binutils/libiberty
+.else
+LIBBFDDIR= ${FBSDGDBDIR}/../bfd
+LIBIBERTYDIR= ${FBSDGDBDIR}/../libiberty
+.endif
+
+LIBBFDOBJ= ${.CURDIR}/../libbfd
+LIBIBERTYOBJ= ${.CURDIR}/../libiberty
+
+libdepend:
+ @echo building dependencies in ${LIBBFDDIR}
+ @mkdir -p ${LIBBFDOBJ}
+ @cd ${LIBBFDDIR} && MAKEOBJDIR=${LIBBFDOBJ} make depend
+ @echo building dependencies in ${LIBIBERTYDIR}
+ @mkdir -p ${LIBIBERTYOBJ}
+ @cd ${LIBIBERTYDIR} && MAKEOBJDIR=${LIBIBERTYOBJ} make depend
+
+libbuild:
+ @echo building libbfd.a
+ @cd ${LIBBFDDIR} && MAKEOBJDIR=${LIBBFDOBJ} make all
+ @echo building libiberty.a
+ @cd ${LIBIBERTYDIR} && MAKEOBJDIR=${LIBIBERTYOBJ} make all
+
links:
@cd ${.CURDIR} && ${.CURDIR}/link-non-local-files.sh
@@ -69,7 +101,12 @@
@cd ${.CURDIR} && ${.CURDIR}/rm-all-links.sh
cd ${.CURDIR} && rm -f ${.CURDIR}/*.core ${.CURDIR}/*~
-CFLAGS+= -I- -I$(.CURDIR) -I${FBSDGDB} -I${DESTDIR}/usr/include/readline -I${BFDDIR}
+CFLAGS+= -I- -I$(.CURDIR) -I${FBSDGDBDIR}
+CFLAGS+= -I${DESTDIR}/usr/include/readline -I${BFDDIR}
+CFLAGS+= -I${GDBDIR}/include -I${GDBDIR}/gdb -I${GDBDIR}/bfd
+CFLAGS+= -I${GDBDIR}/libiberty -I${GDBDIR}/gdb/config
+CFLAGS+= -DHAVE_CONFIG_H
+
# use phkmalloc
CFLAGS+= -DNO_MMALLOC
# uncomment the next line if you want to debug gdb
@@ -78,35 +115,8 @@
CLEANFILES= init.c init.c-tmp
-.if ${OBJFORMAT} == elf
-
-.if exists(${.OBJDIR}/../../binutils/libbfd)
-LIBBFD= ${.OBJDIR}/../../binutils/libbfd/libbfd.a
-.else
-LIBBFD= ${.CURDIR}/../../binutils/libbfd/libbfd.a
-.endif
-
-.if exists(${.OBJDIR}/../../binutils/libiberty)
-LIBIBERTY= ${.OBJDIR}/../../binutils/libiberty/libiberty.a
-.else
-LIBIBERTY= ${.CURDIR}/../../binutils/libiberty/libiberty.a
-.endif
-
-.else
-
-.if exists(${.OBJDIR}/../bfd)
-LIBBFD= ${.OBJDIR}/../bfd/libbfd.a
-.else
-LIBBFD= ${.CURDIR}/../bfd/libbfd.a
-.endif
-
-.if exists(${.OBJDIR}/../libiberty)
-LIBIBERTY= ${.OBJDIR}/../libiberty/libiberty.a
-.else
-LIBIBERTY= ${.CURDIR}/../libiberty/libiberty.a
-.endif
-
-.endif # OBJFORMAT
+LIBBFD= ${LIBBFDOBJ}/libbfd.a
+LIBIBERTY= ${LIBIBERTYOBJ}/libiberty.a
DPADD= ${LIBBFD} ${LIBREADLINE} ${LIBGNUREGEX} ${LIBIBERTY} ${LIBTERMCAP}
LDADD= ${LIBBFD} -lreadline -lgnuregex ${LIBIBERTY} -ltermcap
|