* kinfo.c: Removed.
* kver.c: New file. * Makefile: Include kver.mak. (KVERS): Move this variable to 'kver.mak', which is a generated file. (VERSION_HEADER): New variable to cope with UTS_RELEASE being moved from 'linux/version.h' to 'linux/utsrelease.h' in 2.6.18. (kver, kver.mak): New targets. (KBUILD): New variable. (KVER_MAJOR, KVER_MINOR, BUILD_TYPE, MODULE_TDFX): Likewise, moved from the generated file 'config'. (config, kinfo, kinfo.h): Remove targets. (modules, intstall, clean): Do not depend on config target. (modules, intstall): Depend on sanity target .
This commit is contained in:
@@ -1,3 +1,19 @@
|
||||
2007-02-06 Guillem Jover <guillem@hadrons.org>
|
||||
|
||||
* kinfo.c: Removed.
|
||||
* kver.c: New file.
|
||||
* Makefile: Include kver.mak.
|
||||
(KVERS): Move this variable to 'kver.mak', which is a generated file.
|
||||
(VERSION_HEADER): New variable to cope with UTS_RELEASE being moved
|
||||
from 'linux/version.h' to 'linux/utsrelease.h' in 2.6.18.
|
||||
(kver, kver.mak): New targets.
|
||||
(KBUILD): New variable.
|
||||
(KVER_MAJOR, KVER_MINOR, BUILD_TYPE, MODULE_TDFX): Likewise, moved
|
||||
from the generated file 'config'.
|
||||
(config, kinfo, kinfo.h): Remove targets.
|
||||
(modules, intstall, clean): Do not depend on config target.
|
||||
(modules, intstall): Depend on sanity target .
|
||||
|
||||
2007-02-06 Guillem Jover <guillem@hadrons.org>
|
||||
|
||||
* Makefile (.PHONY): Add clean_kbuild. Rename modules-legacy,
|
||||
|
||||
@@ -17,13 +17,21 @@ endif
|
||||
|
||||
KSRC ?= /usr/src/linux
|
||||
KHEADERS ?= $(KSRC)/include
|
||||
KVERS ?= $(shell ./kinfo --UTS)
|
||||
|
||||
-include kver.mak
|
||||
|
||||
MODULES_DIR = $(DESTDIR)/lib/modules/$(KVERS)
|
||||
|
||||
ALL_CFLAGS := -DMODULE -D__KERNEL__ \
|
||||
-I$(KHEADERS) -I$(KHEADERS)/asm/mach-default \
|
||||
$(CFLAGS)
|
||||
|
||||
ifneq ($(wildcard $(KHEADERS)/linux/utsrelease.h),)
|
||||
VERSION_HEADER := $(KHEADERS)/linux/utsrelease.h
|
||||
else
|
||||
VERSION_HEADER := $(KHEADERS)/linux/version.h
|
||||
endif
|
||||
|
||||
###############################################################################
|
||||
# You should never need to change anything below.
|
||||
|
||||
@@ -31,6 +39,12 @@ NAME := 3dfx
|
||||
|
||||
all: modules
|
||||
|
||||
kver: kver.c
|
||||
$(CC) -include $(VERSION_HEADER) -x c -o $@ $<
|
||||
|
||||
kver.mak: kver
|
||||
./$^ > $@
|
||||
|
||||
# Sanity checks
|
||||
sanity:
|
||||
@( \
|
||||
@@ -50,43 +64,30 @@ sanity:
|
||||
fi; \
|
||||
)
|
||||
|
||||
ifeq ($(wildcard config),config)
|
||||
KVER_MAJOR = $(shell echo "$(KVERS)" | cut -d. -f1 )
|
||||
KVER_MINOR = $(shell echo "$(KVERS)" | cut -d. -f2 )
|
||||
|
||||
config: sanity
|
||||
KBUILD = $(shell [ "$(KVER_MAJOR)" = 2 ] && [ "$(KVER_MINOR)" -ge 6 ] && echo yes )
|
||||
|
||||
include config
|
||||
help:
|
||||
echo KVER_MAJOR = $(KVER_MAJOR)
|
||||
echo KVER_MINOR = $(KVER_MINOR)
|
||||
echo KBUILD = $(KBUILD)
|
||||
|
||||
ifeq ($(KBUILD),yes)
|
||||
BUILD_TYPE = kbuild
|
||||
MODULE_TDFX = kbuild/$(NAME).ko
|
||||
else
|
||||
BUILD_TYPE = legacy
|
||||
MODULE_TDFX = $(NAME).o
|
||||
endif
|
||||
|
||||
clean_type = clean_$(BUILD_TYPE)
|
||||
module_type = module_$(BUILD_TYPE)
|
||||
|
||||
else
|
||||
|
||||
config: sanity kinfo
|
||||
@( \
|
||||
KVER_MAJOR=`echo $(KVERS) | cut -d. -f1`; \
|
||||
KVER_MINOR=`echo $(KVERS) | cut -d. -f2`; \
|
||||
if [ $$KVER_MAJOR = 2 -a $$KVER_MINOR -ge 6 ]; then \
|
||||
echo BUILD_TYPE = kbuild; \
|
||||
echo MODULE_TDFX = kbuild/$(NAME).ko; \
|
||||
else \
|
||||
echo BUILD_TYPE = legacy; \
|
||||
echo MODULE_TDFX = $(NAME).o; \
|
||||
fi; \
|
||||
) > config
|
||||
@$(MAKE) $(MAKECMDGOALS)
|
||||
|
||||
endif
|
||||
|
||||
kinfo: kinfo.c
|
||||
$(CC) -I$(KHEADERS) -o kinfo kinfo.c
|
||||
|
||||
kinfo.h: kinfo
|
||||
@echo Generating kernel information header.
|
||||
@./kinfo
|
||||
|
||||
###############################################################################
|
||||
|
||||
modules: config $(module_type)
|
||||
modules: sanity $(module_type)
|
||||
|
||||
module_legacy: $(NAME).o
|
||||
|
||||
@@ -98,7 +99,7 @@ module_kbuild:
|
||||
|
||||
###############################################################################
|
||||
|
||||
install: config install_modules
|
||||
install: sanity install_modules
|
||||
@( \
|
||||
if [ -e $(MODULES_DIR)/modules.dep ]; then \
|
||||
indep=`grep '$(NAME)/$(MODULE_TDFX):' $(MODULES_DIR)/modules.dep`; \
|
||||
@@ -128,9 +129,8 @@ install_modules: modules
|
||||
###############################################################################
|
||||
# This is for debugging purposes by the developers:
|
||||
|
||||
clean: config $(clean_type)
|
||||
rm -f kinfo kinfo.h
|
||||
rm -f config
|
||||
clean: $(clean_type)
|
||||
rm -f kver.mak kver
|
||||
|
||||
clean_legacy:
|
||||
rm -f *.ko *.o *.mod.* .*.mod.* .*.cmd
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
kinfo.c: A small program that includes several kernel heades
|
||||
and builds a header defining options for 3dfx_driver.c.
|
||||
|
||||
1999/12/22 Joseph Kain <joseph@3dfx.com>
|
||||
|
||||
* Initial version
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* These include files will bring in the information we need */
|
||||
#include <linux/autoconf.h>
|
||||
#include <linux/version.h>
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
/* Here is the strategy. The old Makefile would have grepped the kernel
|
||||
* headers and put these defines on the command line. Now we include
|
||||
* the kernel headers and extract the information. Then we create a
|
||||
* new header with all of the options we need. */
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
FILE *f = fopen ("kinfo.h", "w");
|
||||
FILE *p = NULL;
|
||||
int result;
|
||||
char temp[1000];
|
||||
|
||||
#ifdef CONFIG_MTRR
|
||||
/* It is not enough to just check if the kernel supports MTRRs, if the
|
||||
* processor doesn't have MTRRs then its possible (and likely) that
|
||||
* the kernel was still compiled with MTRR support. So we also have to
|
||||
* check the processor has MTRRs. */
|
||||
|
||||
result = system ("grep mtrr /proc/cpuinfo > /dev/null");
|
||||
|
||||
/* See if grep found anything */
|
||||
if (result == 0) /* Grep reported a match */
|
||||
{
|
||||
fprintf (f, "#define HAVE_MTRR\n");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
fprintf (f, "#define __SMP__\n");
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MODVERSIONS
|
||||
fprintf (f, "#define MODVERSIONS\n");
|
||||
#endif
|
||||
|
||||
fclose (f);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcmp (argv[1], "--UTS") == 0)
|
||||
{
|
||||
printf ("%s", UTS_RELEASE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
8
Device3Dfx/kver.c
Normal file
8
Device3Dfx/kver.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("KVERS = %s\n", UTS_RELEASE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user