libstand: Rework makefile to avoid repeated building
[dragonfly.git] / lib / libstand / Makefile
CommitLineData
984263bc
MD
1# $FreeBSD: src/lib/libstand/Makefile,v 1.14.2.10 2002/07/22 14:21:50 ru Exp $
2#
3# Originally from $NetBSD: Makefile,v 1.21 1997/10/26 22:08:38 lukem Exp $
4#
5# Notes:
6# - We don't use the libc strerror/sys_errlist because the string table is
7# quite large.
8#
9
10LIB= stand
11NOPROFILE= YES
12NOPIC= YES
13INCS= stand.h
14MAN= libstand.3
2983445f 15CSTD?= c99
a9f4a7f2 16WARNS?= 2
984263bc
MD
17
18# Mostly OK, some of the libc imports are a bit noisy
2983445f 19CFLAGS+= -ffreestanding
984263bc 20
7087ece4 21.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
81e6e8a9 22.if ${CCVER:Mgcc*}
984263bc 23CFLAGS+= -mpreferred-stack-boundary=2
81e6e8a9
JM
24.endif
25CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float
eb45cc97 26FORCE_CPUTYPE= i386
984263bc
MD
27.endif
28
7087ece4
SZ
29.if ${MACHINE_ARCH} == "x86_64"
30CFLAGS+= -m32
31.endif
984263bc
MD
32
33# standalone components and stuff we have modified locally
34SRCS+= __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
35 globals.c pager.c printf.c strdup.c strerror.c strtol.c random.c \
36 sbrk.c twiddle.c zalloc.c zalloc_malloc.c
37
38# private (pruned) versions of libc string functions
39SRCS+= strcasecmp.c
40
41# string functions from libc
42.PATH: ${.CURDIR}/../libc/string
b2b3ffcd 43.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
984263bc
MD
44SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
45 memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
46 strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
47 strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
48.endif
6af3b87d
MD
49.PATH: ${.CURDIR}/../libc/quad
50.if ${MACHINE_ARCH} == "i386"
51SRCS+= ucmpdi2.c
52.endif
984263bc 53
cdfd0a3e
MD
54.PATH: ${.CURDIR}/../../sys/libkern
55SRCS+= icrc32.c
56
984263bc 57# _setjmp/_longjmp
b2b3ffcd 58.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
c11dfca6
SS
59.PATH: ${.CURDIR}/i386
60.else
61.endif
984263bc
MD
62# really only required for i386
63CFLAGS+=-I${.CURDIR}/../libc/${MACHINE_ARCH}
c11dfca6 64SRCS+= _setjmp.S
984263bc
MD
65
66# decompression functionality from libbz2
7295dc46 67BZ2DIR= ${.CURDIR}/../../contrib/bzip2
8b980e40
SS
68.PATH: ${BZ2DIR}
69CFLAGS+=-I${BZ2DIR} -DBZ_NO_STDIO -DBZ_NO_COMPRESS
70SRCS+= bzlib.c crctable.c decompress.c huffman.c randtable.c bzlib.h \
71 bzlib_private.h
984263bc
MD
72
73# check your belt - ugly bzip2 stuff ahead
8b980e40
SS
74.for file in bzlib.c
75CLEANFILES+= ${file}
984263bc 76
8b980e40
SS
77${file}: ${BZ2DIR}/${file} ${file}.diff
78 patch -o ${.TARGET} < ${.ALLSRC:M*.diff} ${.ALLSRC:M*.[ch]}
984263bc
MD
79.endfor
80
dfbf249b 81.include "../libz/Makefile.stand"
984263bc
MD
82
83# io routines
84SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \
85 fstat.c close.c lseek.c open.c read.c write.c readdir.c
86
87# network routines
88SRCS+= arp.c ether.c inet_ntoa.c in_cksum.c net.c udp.c netif.c rpc.c
89
90# network info services:
91SRCS+= bootp.c rarp.c bootparam.c
92
93# boot filesystems
6af3b87d 94SRCS+= ufs.c nfs.c cd9660.c tftp.c zipfs.c bzipfs.c gzipfs.c
984263bc
MD
95SRCS+= netif.c nfs.c
96SRCS+= dosfs.c ext2fs.c
97SRCS+= splitfs.c
cdfd0a3e
MD
98SRCS+= hammer1.c
99SRCS+= hammer2.c
984263bc
MD
100
101.include <bsd.lib.mk>
479d5a0d 102
b2b3ffcd 103.if ${MACHINE_ARCH} == "x86_64"
479d5a0d
SS
104CFLAGS+= -I${.OBJDIR}
105
217126c8 106.PATH: ${.OBJDIR}/machine
479d5a0d 107
217126c8
JM
108in_cksum.c: endian.h stdint.h
109stand.h: stdarg.h
110_setjmp.S: asm.h
111
112endian.h stdint.h asm.h stdarg.h:
479d5a0d 113 mkdir -p machine
217126c8
JM
114 ${LN} -fs ${.CURDIR}/../../sys/cpu/i386/include/${.TARGET:T} \
115 machine/${.TARGET:T}
116
117cpu:
118 mkdir -p ${.TARGET}
479d5a0d 119
217126c8 120beforedepend: cpu
479d5a0d
SS
121
122CLEANDIRS+= machine cpu
123.endif