xref: /onnv-gate/usr/src/cmd/file/Makefile (revision 5565:538e7adac11a)
10Sstevel@tonic-gate#
20Sstevel@tonic-gate# CDDL HEADER START
30Sstevel@tonic-gate#
40Sstevel@tonic-gate# The contents of this file are subject to the terms of the
51976Sab196087# Common Development and Distribution License (the "License").
61976Sab196087# You may not use this file except in compliance with the License.
70Sstevel@tonic-gate#
80Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate# See the License for the specific language governing permissions
110Sstevel@tonic-gate# and limitations under the License.
120Sstevel@tonic-gate#
130Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate#
190Sstevel@tonic-gate# CDDL HEADER END
200Sstevel@tonic-gate#
210Sstevel@tonic-gate#
223466Srie# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate# Use is subject to license terms.
240Sstevel@tonic-gate#
250Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
260Sstevel@tonic-gate#
270Sstevel@tonic-gate
280Sstevel@tonic-gatePROG= file
290Sstevel@tonic-gateXPG4PROG= file
300Sstevel@tonic-gateMAGIC= magic
310Sstevel@tonic-gate
320Sstevel@tonic-gateELFCAP=	$(SRC)/common/elfcap
331976Sab196087SGSRTCID=	$(SRC)/common/sgsrtcid
340Sstevel@tonic-gate
354195Sny155746LOBJS=	file.o elf_read32.o elf_read64.o magicutils.o
360Sstevel@tonic-gateOBJS=	$(LOBJS) elfcap.o
370Sstevel@tonic-gateXPG4OBJS= $(OBJS:%.o=xpg4_%.o)
384195Sny155746SRCS=	file.c elf_read.c magicutils.c $(ELFCAP)/elfcap.c
390Sstevel@tonic-gate
400Sstevel@tonic-gateinclude ../Makefile.cmd
410Sstevel@tonic-gate
420Sstevel@tonic-gatePOFILE= file_all.po
434195Sny155746POFILES= $(SRCS:%.c=%.po)
444195Sny155746
454195Sny155746# The debug binary can be built using the flag
464195Sny155746# -D COPTFLAG=-g CGLOBALSTATIC=
474195Sny155746# This will avoid the multiple symbols definition error
484195Sny155746# for static global variables in elf_read32.o and elf_read64.o
490Sstevel@tonic-gate
500Sstevel@tonic-gateLDLIBS += -lelf
51*5565Sab196087CPPFLAGS += -I$(ELFCAP) -I$(SGSRTCID)
520Sstevel@tonic-gate$(XPG4) := CFLAGS += -DXPG4
530Sstevel@tonic-gate
540Sstevel@tonic-gateROOTETCMAGIC= $(MAGIC:%=$(ROOTETC)/%)
550Sstevel@tonic-gate
560Sstevel@tonic-gate$(ROOTETCMAGIC) :=	FILEMODE =	$(LIBFILEMODE)
570Sstevel@tonic-gate
580Sstevel@tonic-gate.PARALLEL:	$(OBJS) $(XPG4OBJS) $(POFILES)
590Sstevel@tonic-gate
600Sstevel@tonic-gate.KEEP_STATE:
610Sstevel@tonic-gate
620Sstevel@tonic-gateall: $(PROG) $(XPG4) $(MAGIC)
630Sstevel@tonic-gate
640Sstevel@tonic-gate$(PROG) : $(OBJS)
650Sstevel@tonic-gate	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
660Sstevel@tonic-gate	$(POST_PROCESS)
670Sstevel@tonic-gate
680Sstevel@tonic-gate$(XPG4) : $(XPG4OBJS)
690Sstevel@tonic-gate	$(LINK.c) $(XPG4OBJS) -o $@ $(LDLIBS)
700Sstevel@tonic-gate	$(POST_PROCESS)
710Sstevel@tonic-gate
723466Srie%.o:	%.c
733466Srie	$(COMPILE.c) -o $@ $<
743466Srie
754195Sny155746%32.o:	%.c
764195Sny155746	$(COMPILE.c) -o $@ $<
774195Sny155746
784195Sny155746%64.o:	%.c
794195Sny155746	$(COMPILE.c) -D_ELF64 -o $@ $<
804195Sny155746
810Sstevel@tonic-gatexpg4_%.o:	%.c
820Sstevel@tonic-gate	$(COMPILE.c) -o $@ $<
830Sstevel@tonic-gate
844195Sny155746xpg4_%32.o:	%.c
854195Sny155746	$(COMPILE.c) -o $@ $<
864195Sny155746
874195Sny155746xpg4_%64.o:	%.c
884195Sny155746	$(COMPILE.c) -D_ELF64 -o $@ $<
894195Sny155746
900Sstevel@tonic-gateelfcap.o:	$(ELFCAP)/elfcap.c
910Sstevel@tonic-gate	$(COMPILE.c) -o $@ $(ELFCAP)/elfcap.c
920Sstevel@tonic-gate
930Sstevel@tonic-gatexpg4_elfcap.o:	$(ELFCAP)/elfcap.c
940Sstevel@tonic-gate	$(COMPILE.c) -o $@ $(ELFCAP)/elfcap.c
950Sstevel@tonic-gate
960Sstevel@tonic-gate$(POFILE):	$(POFILES)
970Sstevel@tonic-gate	$(RM) $@
980Sstevel@tonic-gate	cat $(POFILES) > $@
990Sstevel@tonic-gate
1000Sstevel@tonic-gateinstall: all $(ROOTPROG) $(ROOTXPG4PROG) $(ROOTETCMAGIC)
1010Sstevel@tonic-gate
1020Sstevel@tonic-gateclean:
1030Sstevel@tonic-gate	$(RM) $(OBJS) $(XPG4OBJS)
1040Sstevel@tonic-gate
1050Sstevel@tonic-gatelint: lint_SRCS
1060Sstevel@tonic-gate
1070Sstevel@tonic-gateinclude ../Makefile.targ
108