xref: /illumos-gate/usr/src/cmd/pools/poolcfg/Makefile (revision 85f4cb87104c72587029a6e0f1663332c85ba118)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
524da5b34Srie# Common Development and Distribution License (the "License").
624da5b34Srie# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
217c478bd9Sstevel@tonic-gate#
2224da5b34Srie# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
2324da5b34Srie# Use is subject to license terms.
247c478bd9Sstevel@tonic-gate#
255661bb76SJohn Levon# Copyright (c) 2018, Joyent, Inc.
267c478bd9Sstevel@tonic-gate
277c478bd9Sstevel@tonic-gatePROG =		poolcfg
287c478bd9Sstevel@tonic-gateOBJS =		poolcfg_lex.o poolcfg_grammar.o
297c478bd9Sstevel@tonic-gateSRCS =		$(OBJS:%.o=%.c) $(COMMON_SRCS)
307c478bd9Sstevel@tonic-gatePOFILES =	$(OBJS:.o=.po)
317c478bd9Sstevel@tonic-gatePOFILE =	poolcfg.po
327c478bd9Sstevel@tonic-gate
337c478bd9Sstevel@tonic-gateinclude ../../Makefile.cmd
347c478bd9Sstevel@tonic-gateinclude ../Makefile.pools
357c478bd9Sstevel@tonic-gate
36df4628cbSrie# poolcf has a name clash with main() and libl.so.1.  However, poolcfg must
37df4628cbSrie# still export a number of "yy*" (libl) interfaces.  Reduce all other symbols
38df4628cbSrie# to local scope.
39df4628cbSrieMAPFILES +=	$(MAPFILE.LEX) $(MAPFILE.NGB)
40*85f4cb87SRichard LoweMAPOPTS =	$(MAPFILES:%=-Wl,-M%)
41df4628cbSrie
427c478bd9Sstevel@tonic-gateLFLAGS =	-t
437c478bd9Sstevel@tonic-gateYFLAGS =	-d
447c478bd9Sstevel@tonic-gateCFLAGS +=	-I$(POOLSCOMMONDIR)
45df4628cbSrieLDFLAGS +=	$(MAPOPTS)
467c478bd9Sstevel@tonic-gateLDLIBS +=	-lpool -ll
477c478bd9Sstevel@tonic-gateXGETFLAGS =	-a
487c478bd9Sstevel@tonic-gateCLOBBERFILES +=	poolcfg_lex.c poolcfg_grammar.c poolcfg_grammar.h
497c478bd9Sstevel@tonic-gate
505661bb76SJohn Levon# not linted
515661bb76SJohn LevonSMATCH=off
525661bb76SJohn Levon
537c478bd9Sstevel@tonic-gate.KEEP_STATE:
547c478bd9Sstevel@tonic-gate
557c478bd9Sstevel@tonic-gateall: $(PROG)
567c478bd9Sstevel@tonic-gate
57df4628cbSrie$(PROG): $(OBJS) $(COMMON_OBJS) $(MAPFILES)
587c478bd9Sstevel@tonic-gate	$(LINK.c) -o $@ $(OBJS) $(COMMON_OBJS) $(LDLIBS)
597c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
607c478bd9Sstevel@tonic-gate
617c478bd9Sstevel@tonic-gate%.o : $(POOLSCOMMONDIR)/%.c
627c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ $<
637c478bd9Sstevel@tonic-gate	$(POST_PROCESS_O)
647c478bd9Sstevel@tonic-gate
657c478bd9Sstevel@tonic-gateinstall: all $(ROOTUSRSBINPROG)
667c478bd9Sstevel@tonic-gate
677c478bd9Sstevel@tonic-gatepoolcfg_lex.c: poolcfg.l poolcfg_grammar.h
687c478bd9Sstevel@tonic-gate	$(LEX) $(LFLAGS) poolcfg.l > $@
697c478bd9Sstevel@tonic-gate
707c478bd9Sstevel@tonic-gatepoolcfg_grammar.h poolcfg_grammar.c: poolcfg.y
717c478bd9Sstevel@tonic-gate	$(YACC) $(YFLAGS) poolcfg.y
727c478bd9Sstevel@tonic-gate	@$(MV) y.tab.h poolcfg_grammar.h
737c478bd9Sstevel@tonic-gate	@$(MV) y.tab.c poolcfg_grammar.c
747c478bd9Sstevel@tonic-gate
757c478bd9Sstevel@tonic-gatepoolcfg_lex.o poolcfg_grammar.o := CCVERBOSE =
767c478bd9Sstevel@tonic-gate
777c478bd9Sstevel@tonic-gateclean:
787c478bd9Sstevel@tonic-gate	$(RM) $(OBJS) $(COMMON_OBJS) $(POFILES)
797c478bd9Sstevel@tonic-gate
807c478bd9Sstevel@tonic-gate$(POFILE):	$(POFILES)
817c478bd9Sstevel@tonic-gate	$(RM) $@; cat $(POFILES) > $@
827c478bd9Sstevel@tonic-gate
837c478bd9Sstevel@tonic-gateinclude ../../Makefile.targ
84