# -----------------------------------------------------------------
# "get_hostcpu.mk", a GNU 'make' include makefile for cpu type de-
# tection on Cygwin (ONLY works on Cygwin).*** Version Sep 11 2002
# Copyright (C) 2002 Soren Andersen
# See the Perl Artistic License for conditions of copying and use.
# -----------------------------------------------------------------
_More_Tidier = $(if $(findstring CPUtool,$(MAKECMDGOALS)),,makehelper_hostcpu.exe)
.INTERMEDIATE: _hostcpu_DELETEME.c $(_More_Tidier)
_hostcpu_DELETEME.c: SHELL=/bin/bash
LP = (
RP = )
default: CPU_tool
@echo made_cpu_tool = $(shell date) >$(CURDIR)/_cpu_tool.mk
@echo HOST_CPU = $(shell ./makehelper_hostcpu.exe) >>$(CURDIR)/_cpu_tool.mk
CPU_tool: makehelper_hostcpu.exe
_hostcpu_DELETEME.c:
@>_hostcpu_DELETEME.c echo -e '#include <sys/utsname.h>'; \
>>_hostcpu_DELETEME.c echo '#include <unistd.h>'; \
>>_hostcpu_DELETEME.c echo '#include <stdio.h>'; \
>>_hostcpu_DELETEME.c echo '#include <string.h>'; \
>>_hostcpu_DELETEME.c echo 'int main $(LP)$(RP)'; \
>>_hostcpu_DELETEME.c echo '{ '; \
>>_hostcpu_DELETEME.c echo ' struct utsname thishost;'; \
>>_hostcpu_DELETEME.c echo ' char *intelNum;'; \
>>_hostcpu_DELETEME.c echo ' if $(LP)uname$(LP)&thishost$(RP) < 0$(RP) {'; \
>>_hostcpu_DELETEME.c echo ' fprintf$(LP) stderr, "Could not get host information"$(RP);'; \
>>_hostcpu_DELETEME.c echo ' return 1;'; \
>>_hostcpu_DELETEME.c echo ' }'; \
>>_hostcpu_DELETEME.c echo " intelNum = strchr(thishost.machine, 'i');"; \
>>_hostcpu_DELETEME.c echo ' if$(LP) intelNum != NULL && strspn$(LP)++intelNum,"23456789"$(RP) == 3 $(RP)'; \
>>_hostcpu_DELETEME.c echo ' {'; \
>>_hostcpu_DELETEME.c echo ' printf$(LP)"%3s\n", intelNum$(RP);'; \
>>_hostcpu_DELETEME.c echo ' return 0;'; \
>>_hostcpu_DELETEME.c echo ' }'; \
>>_hostcpu_DELETEME.c echo ' else { return 1; }'; \
>>_hostcpu_DELETEME.c echo '}'
@echo Done creating host-cpu code.
makehelper_hostcpu.exe: _hostcpu_DELETEME.c
@$(CC) -O2 -o $@ _hostcpu_DELETEME.c || \
echo 'ERROR: failed to build $@ tool! CPU will default to '\"386\".
# Done --------------------------------------------------------------------
code syntax highlighting by
GVIM,
using a modified "nightshimmer" theme.