From 071fc272b68785c3750a3e26f0a677bb9b7286f8 Mon Sep 17 00:00:00 2001 From: leitner Date: Fri, 26 Sep 2003 18:22:46 +0000 Subject: [PATCH] add clever hack to auto-detect the diet libc --- GNUmakefile | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index a66c8ef..f75109b 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -14,13 +14,24 @@ buffer.a mmap.a taia.a tai.a dns.a case.a mult.a array.a io.a all: t $(LIBS) libowfat.a -# comment out the following line if you don't want to build with the -# diet libc (http://www.fefe.de/dietlibc/). -DIET=/opt/diet/bin/diet -Os CC=gcc CFLAGS=-pipe -Wall -O2 -fomit-frame-pointer #CFLAGS=-pipe -Os -march=pentiumpro -mcpu=pentiumpro -fomit-frame-pointer -fschedule-insns2 -Wall +path = $(subst :, ,$(PATH)) +diet_path = $(foreach dir,$(path),$(wildcard $(dir)/diet)) +ifneq ($(strip $(diet_path)),) +ifeq ($(wildcard /opt/diet/bin/diet),/opt/diet/bin/diet) +DIET=/opt/diet/bin/diet +else +DIET= +endif +else +DIET:=$(diet_path) +endif +# to build without diet libc support, use $ make DIET= +# see http://www.fefe.de/dietlibc/ for details about the diet libc + # startrip VPATH=str:byte:fmt:scan:uint:open:stralloc:unix:socket:buffer:mmap:textcode:taia:tai:dns:case:array:mult:io