Re: CPU vs architecture
Stefan Schaeckeler <[email protected]>
| Newsgroups | gmane.os.netbsd.devel.pkgsrc.wip.general |
|---|---|
| Message-ID | <[email protected]> |
Hello,
> > I have a package that can use for certain CPUs different asm code.
> >
> > How do I check in the Makefile for pentium and above vs everything lower?
>
> Why need such a check?
> * Need to specify CPU architecture to build?
Yes.
It's perhaps easier to show the Makefile than to explain in English. It's package wip/bogomips. Relevant part of Makefile:
--- snip ---------------------------------------------------------------------
.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
BUILD_TARGET=bogo586
.elif ${MACHINE_ARCH} == "alpha"
BUILD_TARGET=bogoAlpha
.elif ${MACHINE_ARCH} == "sparc64"
BUILD_TARGET=bogoSparc64
.elif ${MACHINE_ARCH} == "sparc"
BUILD_TARGET=bogoSparc
.elif ${MACHINE_ARCH} == "powerpc"
BUILD_TARGET=bogoPPC
.elif ${MACHINE_ARCH} == "hppa"
BUILD_TARGET=bogoPPC
.else
BUILD_TARGET=bogoport
.endif
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/${BUILD_TARGET} ${DESTDIR}${PREFIX}/bin/bogomips
--- snip ---------------------------------------------------------------------
Every CPU has an own Makefile target. For IA-32, there are two targets: bogo386 and bogo586
The Readme file says "Use [bogo386] for anything that came before a Pentium." I get different results for both targets on my i686.
> * Package auto detect CUP, result in different PLIST?
Don't understand.
> Anyway, it is nice to be selectable (with PKG_OPTIONS?).
> Maybe, someone want to build a fast machine, use the binary package with old machines.
I see several ways to address this problem:
a) leave it as is. Not many ppl have 386 or 486 computers.
b) leave it as is. Not many ppl have 386 or 486 computers. Use PKG_OPTIONS to choose [34]86. Default is 586 and above.
c) compile and install both versions (/usr/pkg/bin/bogo386 and /usr/pkg/bin/bogo586). I don't know what to write in PLIST, then. For other architectures, I'll have a different program name (/usr/pkg/bin/bogomips).
Further ideas? What is the best way to solve this?
- Stefan
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev