summaryrefslogtreecommitdiff
path: root/usr/src/cmd/sgs/elfdump/Makefile.targ
diff options
context:
space:
mode:
authorGordon Ross <gwr@nexenta.com>2015-03-04 18:14:23 -0500
committerGordon Ross <gwr@nexenta.com>2015-03-09 11:21:34 -0400
commit1886f67eb9de99edbcda88765f2c603a30c87fc2 (patch)
tree5b0adcf824be1e4edb2ef74d9308f49e1ea3d692 /usr/src/cmd/sgs/elfdump/Makefile.targ
parent2cf749481ab62b6f2e7a25e42c1870d102ce112c (diff)
downloadillumos-joyent-1886f67eb9de99edbcda88765f2c603a30c87fc2.tar.gz
5106 elfdump compiles using headers from the build system
Reviewed by: Robert Mustacchi <rm@joyent.com> Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com> Reviewed by: Richard Lowe <richlowe@richlowe.net> Approved by: Dan McDonald <danmcd@omniti.com>
Diffstat (limited to 'usr/src/cmd/sgs/elfdump/Makefile.targ')
-rw-r--r--usr/src/cmd/sgs/elfdump/Makefile.targ32
1 files changed, 25 insertions, 7 deletions
diff --git a/usr/src/cmd/sgs/elfdump/Makefile.targ b/usr/src/cmd/sgs/elfdump/Makefile.targ
index 5eda4d1b47..8f30f5614c 100644
--- a/usr/src/cmd/sgs/elfdump/Makefile.targ
+++ b/usr/src/cmd/sgs/elfdump/Makefile.targ
@@ -23,7 +23,7 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
+# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
#
%.o: ../common/%.c
@@ -42,18 +42,36 @@
$(COMPILE.c) -o $@ $<
$(POST_PROCESS_O)
-gen_struct_layout: ../common/gen_struct_layout.c
- $(NATIVECC) $(NATIVECC_CFLAGS) $(CFLAGS) -o $@ \
- ../common/gen_struct_layout.c
+all: $(PROG)
-$(PROG): $(OBJS) $(MAPFILE) gen_struct_layout
+$(PROG): $(OBJS) $(MAPFILE) check_struct_layout
$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
$(POST_PROCESS)
-all: $(PROG)
+check_struct_layout: gen_struct_layout gen_layout_obj.o
+ sed -e '/^#include <struct_layout.h>/q' \
+ ../common/struct_layout_$(ARCH).c | sed -e '$$d' \
+ > struct_layout_$(ARCH).tmp
+ ./gen_struct_layout gen_layout_obj.o $(ARCH) \
+ >> struct_layout_$(ARCH).tmp
+ diff -u struct_layout_$(ARCH).tmp \
+ ../common/struct_layout_$(ARCH).c ||\
+ { echo "Error: struct_layout_$(ARCH).c needs update!" ; exit 1; }
+ touch check_struct_layout
+
+# We need CTF data in this object.
+gen_layout_obj.o := CFLAGS += $(CTF_FLAGS)
+gen_layout_obj.o := CFLAGS64 += $(CTF_FLAGS)
+gen_layout_obj.o := POST_PROCESS_O = $(CTFCONVERT_O)
+
+gen_struct_layout: ../common/gen_struct_layout.c
+ $(NATIVECC) $(NATIVECC_CFLAGS) -o $@ \
+ ../common/gen_struct_layout.c -lctf
clean:
- $(RM) $(OBJS) $(CLEANFILES)
+ $(RM) $(OBJS) $(CLEANFILES) gen_struct_layout \
+ check_struct_layout gen_layout_obj.o \
+ struct_layout_$(ARCH).tmp
delete:
$(RM) $(PROG)