xref: /original-bsd/lib/csu/i386/Makefile (revision 7717c4d4)
1#-
2# Copyright (c) 1990 The Regents of the University of California.
3# All rights reserved.
4#
5# This code is derived from software contributed to Berkeley by
6# William Jolitz.
7#
8#
9# Copying or redistribution in any form is explicitly forbidden
10# unless prior written permission is obtained from William Jolitz or an
11# authorized representative of the University of California, Berkeley.
12#
13# Freely redistributable copies of this code will be available in
14# the near future; for more information contact William Jolitz or
15# the Computer Systems Research Group at the University of California,
16# Berkeley.
17#
18# The name of the University may not be used to endorse or promote
19# products derived from this software without specific prior written
20# permission.  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY
21# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE
22# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23# PURPOSE.
24#	@(#)Makefile	5.1 (Berkeley) 04/23/90
25CC=gcc
26AS=a386
27#
28#	crt0	Normal C run time startoff
29#	mcrt0	C run time start off for profiling, ``prof'' conventions
30#	gcrt0	C run time start off for profiling, ``gprof'' conventions
31#
32DESTDIR=
33SRCS=	crt0.c # mon.c gmon.c
34OBJS=	crt0.o # mcrt0.o gcrt0.o mon.o gmon.o
35TAGSFILE=tags
36
37all: ${OBJS}
38
39install: ${OBJS}
40	mv crt0.o ${DESTDIR}/lib/crt0.o
41	# mv mcrt0.o ${DESTDIR}/lib/mcrt0.o
42	# mv gcrt0.o ${DESTDIR}/usr/lib/gcrt0.o
43
44crt0.o:	crt0.c
45	${CC} -S ${DFLAGS} -DCRT0 crt0.c
46	grep -v "^#[ _]" <crt0.s >x.s
47	mv x.s crt0.s
48	/lib/cpp crt0.s > x.s
49	${AS} -o x.o x.s
50	ld -x -r -o crt0.o x.o
51	rm -f x.s x.o crt0.s
52
53moncrt0.o: crt0.c
54	${CC} -S ${DFLAGS} -DMCRT0 crt0.c
55	grep -v "^#[ _]" <crt0.s >x.s
56	mv x.s crt0.s
57	/lib/cpp crt0.s > x.s
58	${AS} -o x.o x.s
59	ld -x -r -o moncrt0.o x.o
60	rm -f x.s x.o crt0.s
61
62gcrt0.o: moncrt0.o gmon.o
63	ld -x -r -o gcrt0.o moncrt0.o gmon.o
64
65mcrt0.o: moncrt0.o mon.o
66	ld -x -r -o mcrt0.o moncrt0.o mon.o
67
68mon.o: mon.c mon.ex
69	${CC} -S ${DEFS} ${DFLAGS} mon.c
70	ex - mon.s < mon.ex
71	${AS} -o x.o mon.s
72	ld -x -r -o mon.o x.o
73	rm -f x.o mon.s
74
75gmon.o: gmon.c gmon.h gmon.ex
76	${CC} -S ${DEFS} ${DFLAGS} gmon.c
77	ex - gmon.s < gmon.ex
78	${AS} -o x.o gmon.s
79	ld -x -r -o gmon.o x.o
80	rm -f x.o gmon.s
81
82tags:
83	cwd=`pwd`; \
84	for i in ${SRCS}; do \
85		ctags -a -f ${TAGSFILE} $$cwd/$$i; \
86	done
87
88clean:
89	rm -f ${OBJS} *.o *.s core errs tags Makefile.bak
90
91lint:	crt0.c
92	lint crt0.c -DMCRT0
93	lint crt0.c -DGCRT0
94	lint crt0.c -DCRT0
95
96depend:
97	for i in ${SRCS}; do \
98	    ${CC} -M ${DEFS} ${DFLAGS} $$i | awk ' { if ($$1 != prev) \
99		{ if (rec != "") print rec; rec = $$0; prev = $$1; } \
100		else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
101		else rec = rec " " $$2 } } \
102		END { print rec } ' >> makedep; done
103	echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
104	echo '$$r makedep' >>eddep
105	echo 'w' >>eddep
106	cp Makefile Makefile.bak
107	ed - Makefile < eddep
108	rm eddep makedep
109	echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
110	echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
111	echo '# see make depend above' >> Makefile
112
113# DO NOT DELETE THIS LINE -- make depend uses it
114
115crt0.o: crt0.c
116mon.o: mon.c
117gmon.o: gmon.c ./gmon.h
118# DEPENDENCIES MUST END AT END OF FILE
119# IF YOU PUT STUFF HERE IT WILL GO AWAY
120# see make depend above
121