116d86563SAlexander Pyhalov#
216d86563SAlexander Pyhalov# CDDL HEADER START
316d86563SAlexander Pyhalov#
416d86563SAlexander Pyhalov# The contents of this file are subject to the terms of the
516d86563SAlexander Pyhalov# Common Development and Distribution License (the "License").
616d86563SAlexander Pyhalov# You may not use this file except in compliance with the License.
716d86563SAlexander Pyhalov#
816d86563SAlexander Pyhalov# You can obtain a copy of the license at src/OPENSOLARIS.LICENSE
916d86563SAlexander Pyhalov# or http://www.opensolaris.org/os/licensing.
1016d86563SAlexander Pyhalov# See the License for the specific language governing permissions
1116d86563SAlexander Pyhalov# and limitations under the License.
1216d86563SAlexander Pyhalov#
1316d86563SAlexander Pyhalov# When distributing Covered Code, include this CDDL HEADER in each
1416d86563SAlexander Pyhalov# file and include the License file at src/OPENSOLARIS.LICENSE.
1516d86563SAlexander Pyhalov# If applicable, add the following below this CDDL HEADER, with the
1616d86563SAlexander Pyhalov# fields enclosed by brackets "[]" replaced with your own identifying
1716d86563SAlexander Pyhalov# information: Portions Copyright [yyyy] [name of copyright owner]
1816d86563SAlexander Pyhalov#
1916d86563SAlexander Pyhalov# CDDL HEADER END
2016d86563SAlexander Pyhalov#
2116d86563SAlexander Pyhalov#
2216d86563SAlexander Pyhalov#
2316d86563SAlexander Pyhalov# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
2416d86563SAlexander Pyhalov# Use is subject to license terms.
2516d86563SAlexander Pyhalov#
2616d86563SAlexander Pyhalov
2716d86563SAlexander Pyhalov# common makefile to handle the most common parts of code: i.e.
2816d86563SAlexander Pyhalov# copying static files from the src dir to the proto dir.
2916d86563SAlexander Pyhalov
3016d86563SAlexander Pyhalovinclude $(SRC)/Makefile.master
3116d86563SAlexander Pyhalov
3216d86563SAlexander Pyhalovall:=		TARGET= all
3316d86563SAlexander Pyhalovinstall :=	TARGET= install
3416d86563SAlexander Pyhalovclean :=	TARGET= clean
3516d86563SAlexander Pyhalovclobber :=	TARGET= clobber
3616d86563SAlexander Pyhalov
3716d86563SAlexander PyhalovOBJS		= $(SRCS:%.c=%.o)
3816d86563SAlexander PyhalovPROGS		= $(OBJS:%.o=%.so)
3916d86563SAlexander Pyhalov
4016d86563SAlexander PyhalovCREATE_LINKS = .links_created
4116d86563SAlexander Pyhalov
4216d86563SAlexander PyhalovCLEANFILES	= *.o *.so.* *.so $(CREATE_LINKS)
4316d86563SAlexander Pyhalov
4416d86563SAlexander PyhalovPROTOCLEANFILES = $(ICONV_LIBS) $(ICONV_LIBS_64)
4516d86563SAlexander Pyhalov
4684d9cd0fSToomas SoomeCPPFLAGS	+= -I../../inc -I. -I../../common
4784d9cd0fSToomas SoomeCFLAGS		+= $(C_PICFLAGS) $(GSHARED)
4816d86563SAlexander Pyhalov
4916d86563SAlexander PyhalovDYNFLAGS=	$(GSHARED) $(ZTEXT) $(ZDEFS) $(BDIRECT) \
50*85f4cb87SRichard Lowe		$(MAPFILES:%=-Wl,-M%) $(MAPFILE.PGA:%=-Wl,-M%) $(MAPFILE.NED:%=-Wl,-M%)
5116d86563SAlexander Pyhalov
5216d86563SAlexander PyhalovLDLIBS=		-lc
5316d86563SAlexander Pyhalov
5416d86563SAlexander PyhalovICONV_DIR	= $(ROOT)/usr/lib/iconv
5516d86563SAlexander Pyhalov
56241c90a0SRichard LoweICONV_DIR_64	= $(ROOT)/usr/lib/iconv/$(MACH64)
5716d86563SAlexander Pyhalov
5816d86563SAlexander PyhalovICONV_LIBS	= $(PROGS:%=$(ICONV_DIR)/%)
5916d86563SAlexander Pyhalov
6016d86563SAlexander PyhalovICONV_LIBS_64	= $(PROGS:%=$(ICONV_DIR_64)/%)
6116d86563SAlexander Pyhalov
6216d86563SAlexander Pyhalov$(ICONV_LIBS) :=      FILEMODE= 755
6316d86563SAlexander Pyhalov
6416d86563SAlexander Pyhalov$(ICONV_LIBS_64) :=      FILEMODE= 755
6516d86563SAlexander Pyhalov
6616d86563SAlexander Pyhalov$(ICONV_DIR) $(ICONV_DIR_64):
6716d86563SAlexander Pyhalov	$(INS.dir) $@
6816d86563SAlexander Pyhalov
6916d86563SAlexander Pyhalov$(ICONV_DIR)/%: %
7016d86563SAlexander Pyhalov	$(INS.file)
7116d86563SAlexander Pyhalov
7216d86563SAlexander Pyhalov$(ICONV_DIR_64)/%: %
7316d86563SAlexander Pyhalov	$(INS.file)
7416d86563SAlexander Pyhalov
7516d86563SAlexander Pyhalov$(ICONV_DIR)/%: ../%
7616d86563SAlexander Pyhalov	$(INS.file)
7716d86563SAlexander Pyhalov
7816d86563SAlexander Pyhalov%.so: %.o
7916d86563SAlexander Pyhalov	$(CC) $(CFLAGS) $(DYNFLAGS) $(LDLIBS) -o $@ $(@:%.so=%.o)
8016d86563SAlexander Pyhalov	$(POST_PROCESS_SO)
8116d86563SAlexander Pyhalov
8216d86563SAlexander Pyhalov%.o: ../%.c
8384d9cd0fSToomas Soome	$(COMPILE.c) $(CFLAGS) -o $@ $<
8416d86563SAlexander Pyhalov	$(POST_PROCESS_O)
8516d86563SAlexander Pyhalov
8616d86563SAlexander Pyhalov%.o: ../common/%.c
8784d9cd0fSToomas Soome	$(COMPILE.c) $(CFLAGS) -o $@ $<
8816d86563SAlexander Pyhalov	$(POST_PROCESS_O)
8916d86563SAlexander Pyhalov
9016d86563SAlexander Pyhalov%.o: %.c
9184d9cd0fSToomas Soome	$(COMPILE.c) $(CFLAGS) -o $@ $<
9216d86563SAlexander Pyhalov	$(POST_PROCESS_O)
9316d86563SAlexander Pyhalov
9416d86563SAlexander Pyhalovclean:
9516d86563SAlexander Pyhalov	$(RM) $(CLEANFILES)
9616d86563SAlexander Pyhalov
9716d86563SAlexander Pyhalovclobber: clean
9816d86563SAlexander Pyhalov	$(RM) $(PROTOCLEANFILES)
9916d86563SAlexander Pyhalov
10016d86563SAlexander PyhalovFRC:
101