[142] | 1 | # $Id: Makefile 142 2000-04-23 14:55:46Z ktk $
|
---|
| 2 |
|
---|
| 3 | # Comment/uncomment the following line to disable/enable build options
|
---|
| 4 | DEBUG = n
|
---|
| 5 | KERNELVERSION = auto
|
---|
| 6 | KERNELSOURCE=/usr/src/linux
|
---|
| 7 |
|
---|
| 8 | ifneq ($(shell grep '__rh_kernel_version_h__' $(KERNELSOURCE)/include/linux/version.h),)
|
---|
| 9 | # redhat kernel headers style
|
---|
| 10 | SUB := $(shell grep __BOOT_KERNEL_ /boot/kernel.h 2>/dev/null | grep 1 | cut -d\_ -f5 | tr [:upper:] [:lower:] | cut -d' ' -f1)
|
---|
| 11 | VERSION_H := version-$(SUB).h
|
---|
| 12 | AUTOCONF_H := autoconf-$(SUB).h
|
---|
| 13 | else
|
---|
| 14 | VERSION_H := version.h
|
---|
| 15 | AUTOCONF_H := autoconf.h
|
---|
| 16 | endif
|
---|
| 17 |
|
---|
| 18 | ifeq ($(KERNELVERSION),auto)
|
---|
| 19 | KERNELVERSION := $(shell grep UTS_RELEASE $(KERNELSOURCE)/include/linux/$(VERSION_H) 2>/dev/null | cut -d\" -f2)
|
---|
| 20 | endif
|
---|
| 21 |
|
---|
| 22 | KERNELRELEASE := $(shell echo $(KERNELVERSION) | cut -d\" -f2| cut -c-3)
|
---|
| 23 |
|
---|
| 24 | ifeq ($(KERNELRELEASE),2.2)
|
---|
| 25 | KERNEL_EXTRA_INCLUDES := -I2.2/
|
---|
| 26 | else
|
---|
| 27 | ifeq ($(KERNELRELEASE),2.3)
|
---|
| 28 | KERNELRELEASE := 2.4
|
---|
| 29 | KERNEL_EXTRA_INCLUDES := -I./
|
---|
| 30 | endif
|
---|
| 31 | endif
|
---|
| 32 |
|
---|
| 33 | # extract config options from the kernel headers
|
---|
| 34 | dummy := $(shell grep 'define' $(KERNELSOURCE)/include/linux/$(AUTOCONF_H) | grep 'CONFIG' | awk '{ print $$2 "=y"}' - > .config)
|
---|
| 35 |
|
---|
| 36 | include $(KERNELRELEASE)/Makefile
|
---|
| 37 |
|
---|
| 38 | #CFLAGS += -DPRIVATE_PCM_VOLUME
|
---|
| 39 |
|
---|
| 40 | ifeq ($(DEBUG),y)
|
---|
| 41 | CFLAGS := $(CFLAGS) -DEMU10K1_DEBUG
|
---|
| 42 | endif
|
---|
| 43 |
|
---|
| 44 | CFLAGS := $(CFLAGS) $(MODFLAGS) $(KERNEL_EXTRA_INCLUDES)
|
---|
| 45 |
|
---|
| 46 | EMU10K1 = emu10k1.o
|
---|
| 47 | EMU10K1-JOY = emu10k1-joy.o
|
---|
| 48 | SRC = audio.c cardmi.c cardmo.c cardwi.c cardwo.c efxmgr.c emuadxmg.c\
|
---|
| 49 | hwaccess.c irqmgr.c main.c midi.c mixer.c osutils.c recmgr.c timer.c voicemgr.c
|
---|
| 50 |
|
---|
| 51 | all: .depend $(EMU10K1) $(EMU10K1-JOY)
|
---|
| 52 |
|
---|
| 53 | $(EMU10K1): $(SRC:.c=.o)
|
---|
| 54 | $(LD) -r $^ -o $@
|
---|
| 55 |
|
---|
| 56 | install:
|
---|
| 57 | mkdir -p /lib/modules/$(KERNELVERSION)/misc
|
---|
| 58 | install -c -m 664 $(EMU10K1) $(EMU10K1-JOY) /lib/modules/$(KERNELVERSION)/misc
|
---|
| 59 | /sbin/depmod -a $(KERNELVERSION)
|
---|
| 60 | /sbin/modprobe -r $(EMU10K1) $(EMU10K1-JOY)
|
---|
| 61 |
|
---|
| 62 | clean:
|
---|
| 63 | rm -f core .config `find . -name '*.[oas]' -o -name '*~' -o -name core -o -name dep -o -name .depend`
|
---|
| 64 |
|
---|
| 65 | depend .depend dep:
|
---|
| 66 | @if [ ! -f $(KERNELSOURCE)/include/linux/modversions.h ]; then \
|
---|
| 67 | echo "Please run make dep in your kernel source tree modversions.h is missing" ;\
|
---|
| 68 | exit 1; fi
|
---|
| 69 | @echo "Driver for KERNELVERSION = $(KERNELVERSION)"
|
---|
| 70 | $(CC) $(CFLAGS) -M $(SRC) > $@
|
---|
| 71 |
|
---|
| 72 | ifeq (.depend,$(wildcard .depend))
|
---|
| 73 | include .depend
|
---|
| 74 | endif
|
---|
| 75 |
|
---|