Makefile.inc revision 1.33       1 # $NetBSD: Makefile.inc,v 1.33 2020/03/01 22:47:26 roy Exp $
      2 #
      3 # Include this fragment to build libhack.o
      4 # It is .o and not .a to make sure these are the
      5 # objects you get (and not the ones in libc.a)
      6 #
      7 
      8 #
      9 # Required variables:
     10 #	HACKSRC		This directory
     11 #
     12 # Optional variables:
     13 #	HACKOBJS	Extra objects to build.
     14 #			The following extra objects are available:
     15 #			gethost.o	cut-down gethostby{name,addr}()
     16 #					that only supports /etc/hosts
     17 #
     18 
     19 .include <bsd.own.mk>
     20 
     21 CPPFLAGS+=	-DSMALL
     22 CPPFLAGS+=	-DLIBHACK
     23 
     24 # Build as re-entrant.
     25 # A few tool using libhack, such as zpool on the ramdisk-zfsroot,
     26 # expect this and it's simpler just to set it globally rather than
     27 # debugging why stuff randomly crashes.
     28 CPPFLAGS+=	-D_REENTRANT
     29 
     30 HACKOBJS+=	getcap.o getgrent.o getnet.o getnetgr.o getpwent.o jemalloc.o \
     31 		localeconv.o multibyte.o perror.o runetable.o setlocale.o \
     32 		nl_langinfo.o strcasecmp.o \
     33 		strerror.o strsignal.o syslog.o utmp.o fmtcheck.o
     34 
     35 .if (${USE_YP} != "no")
     36 HACKOBJS+=	yplib.o
     37 .endif
     38 
     39 .if ${HACK_CURSES:Uno} == "yes"
     40 CURSES_SRC!=	cd ${HACKSRC}/../../../lib/libcurses && \
     41 		${MAKE} DISABLE_WCHAR=yes -v SRCS
     42 
     43 .for s in ${CURSES_SRC}
     44 CPPFLAGS.${s}+=	-DDISABLE_WCHAR -DSMALL \
     45 		-I${HACKSRC}/../../../lib/libcurses \
     46 		-I${HACKSRC}/../../../lib/libterminfo
     47 HACKOBJS+=	${s:S/.c/.o/}
     48 ${s:S/.c/.o/}:	${HACKSRC}/../../../lib/libcurses/${s}
     49 .endfor
     50 .endif
     51 
     52 CPPFLAGS.runetable.c+= -I${HACKSRC}/../../../lib/libc/citrus \
     53 			-DALL_80_TO_FF_SW1
     54 
     55 CPPFLAGS.syslog.c+= -I${HACKSRC}/../../../lib/libc/include
     56 CPPFLAGS.jemalloc.c+= -I${HACKSRC}/../../../lib/libc/include
     57 CPPFLAGS.gethost.c+= -I${HACKSRC}/../../../lib/libc/net
     58 
     59 .if !defined(LIB)
     60 libhack.o: ${HACKOBJS}
     61 	${LD} -r -o $@ ${.ALLSRC}
     62 .endif
     63 
     64 .if 1
     65 .PATH.c: \
     66 	${HACKSRC} \
     67 	${HACKSRC}/../../../lib/libc/gen \
     68 	${HACKSRC}/../../../lib/libc/locale \
     69 	${HACKSRC}/../../../lib/libc/stdlib
     70 .else
     71 # XXX .PATH won't work here, because of crunchgen used by various builds
     72 getcap.o:	${HACKSRC}/../../../lib/libc/gen/getcap.c
     73 getgrent.o:	${HACKSRC}/getgrent.c
     74 gethost.o:	${HACKSRC}/gethost.c
     75 getnet.o:	${HACKSRC}/getnet.c
     76 getnetgr.o:	${HACKSRC}/getnetgr.c
     77 getpwent.o:	${HACKSRC}/getpwent.c
     78 localeconv.o:	${HACKSRC}/localeconv.c
     79 multibyte.o:	${HACKSRC}/multibyte.c
     80 perror.o:	${HACKSRC}/perror.c
     81 jemalloc.o:	${HACKSRC}/../../../lib/libc/stdlib/jemalloc.c
     82 runetable.o:	${HACKSRC}/../../../lib/libc/locale/runetable.c
     83 setlocale.o:	${HACKSRC}/setlocale.c
     84 strerror.o:	${HACKSRC}/strerror.c
     85 strsignal.o:	${HACKSRC}/strsignal.c
     86 syslog.o:	${HACKSRC}/syslog.c
     87 utmp.o:		${HACKSRC}/utmp.c
     88 .if (${USE_YP} != "no")
     89 yplib.o:	${HACKSRC}/yplib.c
     90 .endif
     91 .endif
     92