xref: /openbmc/linux/kernel/debug/kdb/Makefile (revision ada64e4c)
15d5314d6SJason Wessel# This file is subject to the terms and conditions of the GNU General Public
25d5314d6SJason Wessel# License.  See the file "COPYING" in the main directory of this archive
35d5314d6SJason Wessel# for more details.
45d5314d6SJason Wessel#
55d5314d6SJason Wessel# Copyright (c) 1999-2004 Silicon Graphics, Inc.  All Rights Reserved.
65d5314d6SJason Wessel# Copyright (c) 2009 Wind River Systems, Inc. All Rights Reserved.
75d5314d6SJason Wessel#
85d5314d6SJason Wessel
95d5314d6SJason WesselCCVERSION	:= $(shell $(CC) -v 2>&1 | sed -ne '$$p')
105d5314d6SJason Wesselobj-y := kdb_io.o kdb_main.o kdb_support.o kdb_bt.o gen-kdb_cmds.o kdb_bp.o kdb_debugger.o
11ada64e4cSJason Wesselobj-$(CONFIG_KDB_KEYBOARD)    += kdb_keyboard.o
125d5314d6SJason Wessel
135d5314d6SJason Wesselclean-files := gen-kdb_cmds.c
145d5314d6SJason Wessel
155d5314d6SJason Wesselquiet_cmd_gen-kdb = GENKDB  $@
165d5314d6SJason Wessel      cmd_gen-kdb = $(AWK) 'BEGIN {print "\#include <linux/stddef.h>"; print "\#include <linux/init.h>"} \
175d5314d6SJason Wessel		/^\#/{next} \
185d5314d6SJason Wessel		/^[ \t]*$$/{next} \
195d5314d6SJason Wessel		{gsub(/"/, "\\\"", $$0); \
205d5314d6SJason Wessel		  print "static __initdata char kdb_cmd" cmds++ "[] = \"" $$0 "\\n\";"} \
215d5314d6SJason Wessel		END {print "extern char *kdb_cmds[]; char __initdata *kdb_cmds[] = {"; for (i = 0; i < cmds; ++i) {print "  kdb_cmd" i ","}; print("  NULL\n};");}' \
225d5314d6SJason Wessel		$(filter-out %/Makefile,$^) > $@#
235d5314d6SJason Wessel
245d5314d6SJason Wessel$(obj)/gen-kdb_cmds.c:	$(src)/kdb_cmds $(src)/Makefile
255d5314d6SJason Wessel	$(call cmd,gen-kdb)
26