lkml.org 
[lkml]   [1999]   [Dec]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] asm*/resource.h fix for glibc
On Fri, 17 Dec 1999, Michael Barabanov wrote:

> PCMCIA and ALSA, for example, have to use complex scripts that
> parse .config etc to get this information.

They don't have to!

> It would be very nice if there was some standard way to get all
> of the needed CFLAGS and paths for a specific kernel.

There is a trick to dig inside the kernels Makefile and use it
directly together with an own Makefile and even build
subdirectories.

The only problem is the fscking pathdown.sh-script, which
is used to symlink all built modules into /usr/src/linux/modules/

If we could just get rid of this, life would be _much_ easier for
external modules...

Attached examples on how to use it.
Structure:
./Makefile (attached)
./interfaces/Makefile (attached)
./chips/Makefile (not attached)

Just type "make dep" for dependencies, "make here" to build the
modules and "make clean" for cleaning.

Regards

Ingo Oeser
--
Feel the power of the penguin - run linux@your.pc
<esc>:x
# $Id: Makefile,v 1.11 1999/09/18 21:08:08 ioe Exp $


#################################################
# some magic for using linux kernel settings
# when compiling module(s)

MIX_OBJS = generic.o dsp_procfs.o
M_OBJS = dsp_base.o

.EXPORT_ALL_VARIABLES:

# currently running kernel
CURRENT=$(shell uname -r)

# where the kernel sources are located
# KERNEL_LOCATION=/usr/src/linux-$(CURRENT)
KERNEL_LOCATION=/usr/src/linux
TOPDIR:=$(KERNEL_LOCATION)
HPATH=$(TOPDIR)/include
FINDHPATH= $(HPATH)/asm $(HPATH)/linux $(HPATH)/scsi $(HPATH)/net .

# CFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer

CROSS_COMPILE =

AS =$(CROSS_COMPILE)as
LD =$(CROSS_COMPILE)ld
CC =$(CROSS_COMPILE)gcc -D__KERNEL__ -I$(HPATH)
CPP =$(CC) -E
AR =$(CROSS_COMPILE)ar
NM =$(CROSS_COMPILE)nm
STRIP =$(CROSS_COMPILE)strip
OBJDUMP =$(CROSS_COMPILE)objdump
MAKE =make
GENKSYMS=/sbin/genksyms
EXTRA_CFLAGS = -DDEBUG

ifdef CONFIG_SMP
CFLAGS += -D__SMP__
AFLAGS += -D__SMP__
endif

SUB_DIRS := chips interfaces
MOD_SUB_DIRS := $(SUB_DIRS)
ALL_SUB_DIRS := $(SUB_DIRS)

include $(TOPDIR)/.config
ifeq (.depend,$(wildcard .depend))
include .depend
here:
else
here: dep
endif
DIR=`pwd`; (cd $(KERNEL_LOCATION); make SUBDIRS=$$DIR modules)

install:
su -c "cp -v $(M_OBJS) $(MX_OBJS) /lib/modules/$(CURRENT)/misc"

clean:
-rm -f $(MI_OBJS) $(MIX_OBJS) $(M_OBJS) $(MX_OBJS) .*.o.flags *~
for i in $(ALL_SUB_DIRS); do ( cd $$i; $(MAKE) clean ); done

dep:
$(KERNEL_LOCATION)/scripts/mkdep $(wildcard *.c) > .depend
$(KERNEL_LOCATION)/scripts/mkdep `find $(FINDHPATH) -follow -name \*.h ! -name modversions.h -print` > .hdepend

dsp_base.o: $(MIX_OBJS) $(MI_OBJS)
$(LD) $(LD_RFLAG) -r -o $@ $(MI_OBJS) $(MIX_OBJS)

include $(KERNEL_LOCATION)/Rules.make
# $Id: Makefile,v 1.1 1999/09/18 21:13:01 ioe Exp $

#EXTRA_CFLAGS = -DDEBUG

M_OBJS = s5933_vanilla.o s5933_iipci44.o int_debug.o

# Special targets

# need this, because kernel Makefiles are too stupid for this
clean:
-rm -f $(MI_OBJS) $(MIX_OBJS) $(M_OBJS) $(MX_OBJS) .*.o.flags *~

# The basic chip with the full interface implemented
s5933_vanilla.c: s5933_chip.h s5933_chip.c
sed 's:\(^#include "\)\(s5933\).h":\1\2_chip.h":' <s5933_chip.c >$@

# The Innovative Integration PCI44 version of this chip
s5933_iipci44.c: s5933_iipci44.h s5933_chip.h s5933_chip.c
sed 's:\(^#include "\)\(s5933\).h":\1\2_iipci44.h":' <s5933_chip.c >$@

# Debugging interface
int_debug.c: debug.c
cat <$< >$@

include $(KERNEL_LOCATION)/Rules.make
\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.104 / U:1.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site