xref: /openbmc/linux/kernel/debug/kdb/Makefile (revision 5d5314d6)
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
115d5314d6SJason Wessel
125d5314d6SJason Wesselclean-files := gen-kdb_cmds.c
135d5314d6SJason Wessel
145d5314d6SJason Wesselquiet_cmd_gen-kdb = GENKDB  $@
155d5314d6SJason Wessel      cmd_gen-kdb = $(AWK) 'BEGIN {print "\#include <linux/stddef.h>"; print "\#include <linux/init.h>"} \
165d5314d6SJason Wessel		/^\#/{next} \
175d5314d6SJason Wessel		/^[ \t]*$$/{next} \
185d5314d6SJason Wessel		{gsub(/"/, "\\\"", $$0); \
195d5314d6SJason Wessel		  print "static __initdata char kdb_cmd" cmds++ "[] = \"" $$0 "\\n\";"} \
205d5314d6SJason Wessel		END {print "extern char *kdb_cmds[]; char __initdata *kdb_cmds[] = {"; for (i = 0; i < cmds; ++i) {print "  kdb_cmd" i ","}; print("  NULL\n};");}' \
215d5314d6SJason Wessel		$(filter-out %/Makefile,$^) > $@#
225d5314d6SJason Wessel
235d5314d6SJason Wessel$(obj)/gen-kdb_cmds.c:	$(src)/kdb_cmds $(src)/Makefile
245d5314d6SJason Wessel	$(call cmd,gen-kdb)
25