Re: Compiling Kernel Modules against the Kernel Source Tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Christoph Wirz <cwirz@gmx.net> [2003-06-06 11:08]:
> 
> My questions:
> ------------
> 	-How can I compile the module that this warning doesn't occur 	 
> 
>          anymore(because source-tree and compiled kernel in my 
> machine 			are the same, they only have different 
> names.)
> 	-Is there a command arround to determine the source tree's 	 
> 
> 	version?
> 	-How does the gcc-compiler know where to look for the kernel 	 
>       	header files? Is there a Environment Variable which 
> determines 			that? Is there a default location?
> 

take a look at the attached Makefile.  It's the one that I make use
of.  /* of course there might be improvements.... if anyone finds a
better solution, please let me know */

wbr,
Lukas
-- 
Lukas Ruf           | Wanna know anything about raw |
<http://www.lpr.ch> | IP?  <http://www.rawip.org>   |
################################################################################
#                   Fairness: Cite the source of information                   #
################################################################################

################################################################################
# $Source: /home/promethos/CVS/crossbow/wv_promethos/Attic/Makefile.publish,v $
#
# $Author: ruf $ 
# $Date: 2003/06/06 09:24:24 $ 
# $Revision: 1.1.2.2 $
#
# Makefile for PromethOS wave video plugin 
#
# Copyright (c) 2002 Computer Engineering and Networks Laboratory, 
# ETH Zurich, Lukas Ruf, <ruf@promethos.org>
# All Rights reserved.
################################################################################

################################################################################
# Basic ideas taken from the Linux source tree's Makefiles                     #
################################################################################

# Adjust the variables where to find the used versions
#
ROOT			:= /home/ruf/PromethOS
LINUX			:= $(ROOT)/linux
WAVEVIDEO	:= $(ROOT)/crossbow/wv_promethos
	
DEST	= promethos_WV.o

FILES = promethos_wv.c Tag.c QualityFilter.c wv_global.c

INCLUDES = QualityFilter.h Tag.h wv_global.h

OBJS  = $(FILES:%.c=%.o)

# includes
INC = -I. 

INC+= -I$(LINUX)/include


CFLAGS = -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer 
CFLAGS+= -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 
CFLAGS+= -march=i686 -DMODULE -DMODVERSIONS 
CFLAGS+= -include $(LINUX)/include/linux/modversions.h  
CFLAGS+= -D__KERNEL__

CC = gcc -x c

VERSION = $(WAVEVIDEO)/version.h

#***************************************************************************
# Override the cc default rule such that cc puts the object files
# into the corresponding subdirectory and not in the current directory.
#***************************************************************************
%.o: %.c
	$(CC) $(CFLAGS) $(INC) -c $< -o $@


.phony: help
help:
	@echo "**************************************************************"
	@echo "* WaveVideo for PromethOS                                    *"
	@echo "* Copyright (c) Computer Engineering and Networks Laboratory *"
	@echo "* Swiss Federal Institute of Technology (ETH) Zurich         *"
	@echo "* Lukas Ruf <ruf@promethos.org>, http://www.promethos.org    *"
	@echo "**************************************************************"
	@echo ""
	@echo "available make targets:"
	@echo "make user    -- to have the user space plugin available"
	@echo "make kernel  -- to have the kernel space plugin available"
	@echo "make clean   -- to clean all the rubbish produced"
	@echo ""
	@echo "Adjust the path of LINUX and ROOT and WAVEVIDEO in this Makefile"

.phony: user
user: $(DEST).user

.phony: kernel
kernel: $(DEST)

$(DEST).user: $(VERSION)
	$(CC) -Wall -o $@ $(FILES)

$(DEST): $(VERSION) $(OBJS) $(INCLUDES)
	$(LD) -r -o $@ $(OBJS) 
	
$(VERSION): $(FILES)
	@rm -f $(VERSION)
	@rm -f promethos_wv.o
	@echo "#define VERSION \"`date`\"" > $(VERSION)

$(MODOBJ): $(COREOBJS) $(FILTEROBJS) $(KOBJS) $(OBJS)  
	$(LD) -r -o $(MODOBJ) $(COREOBJS) $(FILTEROBJS) $(KOBJS) $(OBJS)  

clean:
	@rm -f $(OBJS) $(DEST) $(DEST).user $(VERSION)
	@echo "`pwd` cleaned"


${MODDIR}:
	mkdir ${MODDIR}

bern: clean $(DEST)
	scp $(DEST) komsys-pc-bern:/var/promethos/plugins/

install: clean $(DEST)
	@-mkdir -p /var/promethos
	@-mkdir -p /var/promethos/repository
	cp $(DEST) /var/promethos/repository
	@-chmod -R a+rX /var/promethos/repository

#
# EOF -- This file has not been truncated
#

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux