libstand: Use new LIBSTAND_SRC and LIBSTAND_ARCH variables in makefiles.
authorImre Vadász <imre@vdsz.com>
Sun, 6 Mar 2016 21:21:27 +0000 (22:21 +0100)
committerImre Vadász <imre@vdsz.com>
Wed, 9 Mar 2016 20:01:27 +0000 (21:01 +0100)
* Make it easier to include lib/libstand/Makefile for building different
  variants of libstand. Preparation for adding sys/boot/libstand32.

lib/libstand/Makefile
lib/libz/Makefile.stand

index bfde95a..c11c033 100644 (file)
@@ -15,19 +15,26 @@ MAN=                libstand.3
 CSTD?=         c99
 WARNS?=                2
 
+LIBSTAND_SRC?= ${.CURDIR}
+.if ${MACHINE_ARCH} == "x86_64"
+LIBSTAND_ARCH?=        i386
+.else
+LIBSTAND_ARCH?=        ${MACHINE_ARCH}
+.endif
+
 # Mostly OK, some of the libc imports are a bit noisy
 CFLAGS+=       -ffreestanding
 
-.if ${MACHINE_ARCH} == "x86_64"
+.if ${LIBSTAND_ARCH} == "i386"
 .if ${CCVER:Mgcc*}
 CFLAGS+=       -mpreferred-stack-boundary=2
 .endif
-CFLAGS+=       -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float
 FORCE_CPUTYPE= i386
+CFLAGS+=       -m32
 .endif
 
-.if ${MACHINE_ARCH} == "x86_64"
-CFLAGS+=       -m32
+.if ${LIBSTAND_ARCH} == "i386" || ${LIBSTAND_ARCH} == "x86_64"
+CFLAGS+=       -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float
 .endif
 
 # standalone components and stuff we have modified locally
@@ -39,27 +46,26 @@ SRCS+=      __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
 SRCS+= strcasecmp.c
 
 # string functions from libc
-.PATH: ${.CURDIR}/../libc/string
-.if ${MACHINE_ARCH} == "x86_64"
+.PATH: ${LIBSTAND_SRC}/../libc/string
+.if ${LIBSTAND_ARCH} == "x86_64" || ${LIBSTAND_ARCH} == "i386"
 SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
         memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
         strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
        strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
 .endif
-.PATH: ${.CURDIR}/../../sys/libkern
+.PATH: ${LIBSTAND_SRC}/../../sys/libkern
 SRCS+=  icrc32.c
 
 # _setjmp/_longjmp
-.if ${MACHINE_ARCH} == "x86_64"
-.PATH: ${.CURDIR}/i386
-.else
-.endif
+.PATH: ${LIBSTAND_SRC}/${LIBSTAND_ARCH}
+.if ${LIBSTAND_ARCH} == "x86_64" || ${LIBSTAND_ARCH} == "i386"
 # really only required for i386
-CFLAGS+=-I${.CURDIR}/../libc/${MACHINE_ARCH}
+CFLAGS+=-I${LIBSTAND_SRC}/../libc/${MACHINE_ARCH}
+.endif
 SRCS+= _setjmp.S
 
 # decompression functionality from libbz2
-BZ2DIR=        ${.CURDIR}/../../contrib/bzip2
+BZ2DIR=        ${LIBSTAND_SRC}/../../contrib/bzip2
 .PATH: ${BZ2DIR}
 CFLAGS+=-I${BZ2DIR} -DBZ_NO_STDIO -DBZ_NO_COMPRESS
 SRCS+= bzlib.c crctable.c decompress.c huffman.c randtable.c bzlib.h \
index 48b993b..40479ba 100644 (file)
@@ -3,7 +3,7 @@
 # decompression functionality from libz for libstand
 
 # relative to lib/libstand
-ZLIBDIR= ${.CURDIR}/../../contrib/zlib-1.2
+ZLIBDIR= ${LIBSTAND_SRC}/../../contrib/zlib-1.2
 .PATH: ${ZLIBDIR}
 
 CFLAGS+=-DCOMPILING_LIBSTAND -I${ZLIBDIR}