1#
2# Makefile for the Broadcom CTF
3#
4# Copyright (C) 2010, Broadcom Corporation. All Rights Reserved.
5# 
6# Permission to use, copy, modify, and/or distribute this software for any
7# purpose with or without fee is hereby granted, provided that the above
8# copyright notice and this permission notice appear in all copies.
9# 
10# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
13# SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
15# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17#
18# $Id: Makefile,v 1.1 2009/10/27 01:27:44 Exp $
19#
20
21CTFSRC := ../../../../../router/ctf
22
23CTFOBJS := $(CTFSRC)/hndctf.o $(CTFSRC)/hndctf_linux.o
24
25# Search for sources under src/router/ctf
26ifneq ($(wildcard $(src)/$(CTFSRC)/*.c),)
27EXTRA_CFLAGS += -I../../router/ctf
28ctf-objs := $(CTFOBJS) ctf_ksyms.o
29else
30ctf-objs := $(CTFSRC)/linux/ctf.o
31endif
32
33obj-$(CONFIG_BCM_CTF) := ctf.o
34
35ifneq ($(KERNELRELEASE),)
36# kbuild part of makefile
37else
38# Normal makefile
39KERNELDIR := ../../../../../linux/linux-2.6
40all:
41	$(MAKE) -C $(KERNELDIR) M=`pwd`
42clean:
43	$(MAKE) -C $(KERNELDIR) M=`pwd` clean
44endif
45
46CTFKSYMOBJS := ../../router/ctf/hndctf.o
47
48PHONY += $(src)/ctf_ksyms.c
49
50quiet_cmd_ksyms = CALL    $<
51      cmd_ksyms = $(CONFIG_SHELL) -e $< $(CTFKSYMOBJS) > $@
52
53$(src)/ctf_ksyms.c: $(src)/ctf_ksyms.sh $(CTFKSYMOBJS) FORCE
54	$(call cmd,ksyms)
55
56clean-files += $(CTFSRC)/*.o $(CTFSRC)/*.o $(CTFSRC)/.*.o.cmd
57