8672 proc_t changes broke genunix dmods and walker
[unleashed.git] / usr / src / cmd / file / Makefile
blob0c9f5dd3fd5b36b69400b741a7637bc00ba9dcd5
2 # CDDL HEADER START
4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
19 # CDDL HEADER END
22 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 # Use is subject to license terms.
26 PROG= file
27 XPG4PROG= file
28 MAGIC= magic
30 ELFCAP= $(SRC)/common/elfcap
31 SGSRTCID= $(SRC)/common/sgsrtcid
33 LOBJS= file.o elf_read32.o elf_read64.o magicutils.o
34 OBJS= $(LOBJS) elfcap.o
35 XPG4OBJS= $(OBJS:%.o=xpg4_%.o)
36 SRCS= file.c elf_read.c magicutils.c $(ELFCAP)/elfcap.c
38 include ../Makefile.cmd
40 CERRWARN += -_gcc=-Wno-uninitialized
41 CERRWARN += -_gcc=-Wno-type-limits
43 POFILE= file_all.po
44 POFILES= $(SRCS:%.c=%.po)
46 # The debug binary can be built using the flag
47 # -D COPTFLAG=-g CGLOBALSTATIC=
48 # This will avoid the multiple symbols definition error
49 # for static global variables in elf_read32.o and elf_read64.o
51 LDLIBS += -lelf
52 CPPFLAGS += -I$(ELFCAP) -I$(SGSRTCID)
53 $(XPG4) := CFLAGS += -DXPG4
55 ROOTETCMAGIC= $(MAGIC:%=$(ROOTETC)/%)
57 $(ROOTETCMAGIC) := FILEMODE = $(LIBFILEMODE)
59 .PARALLEL: $(OBJS) $(XPG4OBJS) $(POFILES)
61 .KEEP_STATE:
63 all: $(PROG) $(XPG4) $(MAGIC)
65 $(PROG) : $(OBJS)
66 $(LINK.c) $(OBJS) -o $@ $(LDLIBS)
67 $(POST_PROCESS)
69 $(XPG4) : $(XPG4OBJS)
70 $(LINK.c) $(XPG4OBJS) -o $@ $(LDLIBS)
71 $(POST_PROCESS)
73 %.o: %.c
74 $(COMPILE.c) -o $@ $<
76 %32.o: %.c
77 $(COMPILE.c) -o $@ $<
79 %64.o: %.c
80 $(COMPILE.c) -D_ELF64 -o $@ $<
82 xpg4_%.o: %.c
83 $(COMPILE.c) -o $@ $<
85 xpg4_%32.o: %.c
86 $(COMPILE.c) -o $@ $<
88 xpg4_%64.o: %.c
89 $(COMPILE.c) -D_ELF64 -o $@ $<
91 elfcap.o: $(ELFCAP)/elfcap.c
92 $(COMPILE.c) -o $@ $(ELFCAP)/elfcap.c
94 xpg4_elfcap.o: $(ELFCAP)/elfcap.c
95 $(COMPILE.c) -o $@ $(ELFCAP)/elfcap.c
97 $(POFILE): $(POFILES)
98 $(RM) $@
99 cat $(POFILES) > $@
101 install: all $(ROOTPROG) $(ROOTXPG4PROG) $(ROOTETCMAGIC)
103 clean:
104 $(RM) $(OBJS) $(XPG4OBJS)
106 lint: lint_SRCS
108 include ../Makefile.targ