Makefile revision 7014882c6a3672fd0e5d60200af8643ae53c5928
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont#
6ea2385360e9e2167e65f9286447da9eea189457Tinderbox User# CDDL HEADER START
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont#
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont# The contents of this file are subject to the terms of the
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont# Common Development and Distribution License (the "License").
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont# You may not use this file except in compliance with the License.
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont#
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont# or http://www.opensolaris.org/os/licensing.
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont# See the License for the specific language governing permissions
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont# and limitations under the License.
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont#
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont# When distributing Covered Code, include this CDDL HEADER in each
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont# If applicable, add the following below this CDDL HEADER, with the
2eeb74d1cf5355dd98f6d507a10086e16bb08c4bTinderbox User# fields enclosed by brackets "[]" replaced with your own identifying
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# information: Portions Copyright [yyyy] [name of copyright owner]
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt#
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# CDDL HEADER END
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt#
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt#
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# Use is subject to license terms.
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt#
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis DupontPROG= file
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis DupontXPG4PROG= file
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis DupontMAGIC= magic
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis DupontELFCAP= $(SRC)/common/elfcap
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis DupontSGSRTCID= $(SRC)/common/sgsrtcid
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis DupontLOBJS= file.o elf_read32.o elf_read64.o magicutils.o
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis DupontOBJS= $(LOBJS) elfcap.o
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis DupontXPG4OBJS= $(OBJS:%.o=xpg4_%.o)
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis DupontSRCS= file.c elf_read.c magicutils.c $(ELFCAP)/elfcap.c
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupontinclude ../Makefile.cmd
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis DupontCERRWARN += -_gcc=-Wno-uninitialized
6ea2385360e9e2167e65f9286447da9eea189457Tinderbox UserCERRWARN += -_gcc=-Wno-type-limits
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis DupontPOFILE= file_all.po
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis DupontPOFILES= $(SRCS:%.c=%.po)
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont# The debug binary can be built using the flag
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# -D COPTFLAG=-g CGLOBALSTATIC=
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont# This will avoid the multiple symbols definition error
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt# for static global variables in elf_read32.o and elf_read64.o
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt
14a656f94b1fd0ababd84a772228dfa52276ba15Evan HuntLDLIBS += -lelf
14a656f94b1fd0ababd84a772228dfa52276ba15Evan HuntCPPFLAGS += -I$(ELFCAP) -I$(SGSRTCID)
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt$(XPG4) := CFLAGS += -DXPG4
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont
14a656f94b1fd0ababd84a772228dfa52276ba15Evan HuntROOTETCMAGIC= $(MAGIC:%=$(ROOTETC)/%)
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont$(ROOTETCMAGIC) := FILEMODE = $(LIBFILEMODE)
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont.PARALLEL: $(OBJS) $(XPG4OBJS) $(POFILES)
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt.KEEP_STATE:
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupontall: $(PROG) $(XPG4) $(MAGIC)
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont$(PROG) : $(OBJS)
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont $(LINK.c) $(OBJS) -o $@ $(LDLIBS)
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont $(POST_PROCESS)
ba751492fcc4f161a18b983d4f018a1a52938cb9Evan Hunt
ba751492fcc4f161a18b983d4f018a1a52938cb9Evan Hunt$(XPG4) : $(XPG4OBJS)
ba751492fcc4f161a18b983d4f018a1a52938cb9Evan Hunt $(LINK.c) $(XPG4OBJS) -o $@ $(LDLIBS)
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont $(POST_PROCESS)
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont%.o: %.c
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt $(COMPILE.c) -o $@ $<
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont%32.o: %.c
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont $(COMPILE.c) -o $@ $<
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont%64.o: %.c
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont $(COMPILE.c) -D_ELF64 -o $@ $<
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupontxpg4_%.o: %.c
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont $(COMPILE.c) -o $@ $<
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupontxpg4_%32.o: %.c
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont $(COMPILE.c) -o $@ $<
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupontxpg4_%64.o: %.c
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont $(COMPILE.c) -D_ELF64 -o $@ $<
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupontelfcap.o: $(ELFCAP)/elfcap.c
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont $(COMPILE.c) -o $@ $(ELFCAP)/elfcap.c
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupontxpg4_elfcap.o: $(ELFCAP)/elfcap.c
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont $(COMPILE.c) -o $@ $(ELFCAP)/elfcap.c
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont$(POFILE): $(POFILES)
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont $(RM) $@
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont cat $(POFILES) > $@
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupontinstall: all $(ROOTPROG) $(ROOTXPG4PROG) $(ROOTETCMAGIC)
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupontclean:
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont $(RM) $(OBJS) $(XPG4OBJS)
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupontlint: lint_SRCS
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupontinclude ../Makefile.targ
a631b30b1ddd8b2ea780371d0d99ba1c05bc7e42Francis Dupont