Try a more complex (and more correct?) method for finding kernel inlcude

files
main
Rik Faith 2000-01-17 10:27:29 +00:00
parent fb0ace84a9
commit d545384a2b
2 changed files with 31 additions and 17 deletions

View File

@ -1,6 +1,6 @@
# Makefile -- For the Direct Rendering Manager module (drm)
# Created: Mon Jan 4 09:26:53 1999 by faith@precisioninsight.com
# Revised: Thu Jan 13 09:53:33 2000 by faith@precisioninsight.com
# Revised: Mon Jan 17 05:25:12 2000 by faith@precisioninsight.com
#
# Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
# All rights reserved.
@ -70,27 +70,39 @@ VERSION := $(shell uname -r)
A := /usr/src/linux-$(VERSION)/include
B := /usr/src/linux/include
C := /usr/include
# This detection seems to be broken.
#TREE := $(shell \
# if grep -q $(VERSION) $A/linux/version.h; then echo $A; \
# elif grep -q $(VERSION) $B/linux/version.h; then echo $B; \
# elif grep -q $(VERSION) $C/linux/version.h; then echo $C; \
# else echo 0; fi)
# I'm simplifying it
TREE := $(shell \
if [ -d $A ] ; then echo $A; \
elif [ -d $B ] ; then echo $B; \
elif [ -d $C ] ; then echo $C; \
else echo 0; fi)
V := $(shell gcc -E -nostdinc -I$A picker.c 2>/dev/null \
| grep -s 'RELEASE = ' | cut -d' ' -f3)
ifeq ($(V),"$(VERSION)")
TREE := $A
else
V := $(shell gcc -E -nostdinc -I$B picker.c 2>/dev/null \
| grep -s 'RELEASE = ' | cut -d' ' -f3)
ifeq ($(V),"$(VERSION)")
TREE := $B
else
V := $(shell gcc -E -nostdinc -I$C picker.c 2>/dev/null \
| grep -s 'RELEASE = ' | cut -d' ' -f3)
ifeq ($(V),"$(VERSION)")
TREE := $C
else
TREE := 0
endif
endif
endif
ifeq "$TREE" "0"
all:; echo Error: Could not locate kernel tree
# To override this determination, pass the path on the make command line:
# make TREE=/usr/my-kernel-tree/include
# or hardcode a value for TREE here:
# TREE:=/usr/include
ifeq ($(TREE),0)
all:; @echo Error: Could not locate kernel tree in $A $B $C
else
SMP := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \
| grep 'SMP = ' | cut -d' ' -f3)
| grep -s 'SMP = ' | cut -d' ' -f3)
MODVERSIONS := $(shell gcc -E -I $(TREE) picker.c 2>/dev/null \
| grep 'MODVERSIONS = ' | cut -d' ' -f3)
| grep -s 'MODVERSIONS = ' | cut -d' ' -f3)
all::;@echo KERNEL HEADERS IN $(TREE): SMP=${SMP} MODVERSIONS=${MODVERSIONS}
all:: $(LIBS) $(MODS) $(PROGS)
endif

View File

@ -1,4 +1,5 @@
#include <linux/autoconf.h>
#include <linux/version.h>
#ifndef CONFIG_SMP
#define CONFIG_SMP 0
@ -10,3 +11,4 @@
SMP = CONFIG_SMP
MODVERSIONS = CONFIG_MODVERSIONS
RELEASE = UTS_RELEASE