xref: /illumos-gate/usr/src/cmd/zic/Makefile (revision 3b3f3420f42655c8a4fd7c5639c36b71ee8f23bd)
17c478bd9Sstevel@tonic-gate#
299ba4d70SRussell Blaine# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
399ba4d70SRussell Blaine# Use is subject to license terms.
47c478bd9Sstevel@tonic-gate#
57c478bd9Sstevel@tonic-gate
67c478bd9Sstevel@tonic-gateNATIVE=native
77c478bd9Sstevel@tonic-gatePROG= zic
87c478bd9Sstevel@tonic-gateKSHPROG= tzselect
97c478bd9Sstevel@tonic-gateNPROG= $(NATIVE)/$(PROG)
107c478bd9Sstevel@tonic-gate
117c478bd9Sstevel@tonic-gate# "etcetera" must be listed before "backward" because it sets up links that
127c478bd9Sstevel@tonic-gate# "backward" needs.
137c478bd9Sstevel@tonic-gateTZFILES= africa antarctica asia australasia etcetera europe \
147c478bd9Sstevel@tonic-gate	 factory northamerica pacificnew solar87 solar88 solar89 \
157c478bd9Sstevel@tonic-gate	 southamerica backward
167c478bd9Sstevel@tonic-gate# Don't build the systemv timezones, but do install the source file.
177c478bd9Sstevel@tonic-gateSRCFILES = $(TZFILES) systemv README
187c478bd9Sstevel@tonic-gateTABFILES = continent.tab country.tab zone_sun.tab
197c478bd9Sstevel@tonic-gate
207c478bd9Sstevel@tonic-gateOBJS= zic.o scheck.o ialloc.o
217c478bd9Sstevel@tonic-gateSRCS= $(OBJS:%.o=%.c)
227c478bd9Sstevel@tonic-gateNOBJS= $(OBJS:%=$(NATIVE)/%)
237c478bd9Sstevel@tonic-gateOWNER= root
247c478bd9Sstevel@tonic-gateGROUP= bin
257c478bd9Sstevel@tonic-gate
26*3b3f3420SRussell BlaineCLOBBERFILES= $(NOBJS) $(KSHPROG) $(NPROG) $(NATIVE)/zic.c $(NATIVE)/tzfile.h
277c478bd9Sstevel@tonic-gate
287c478bd9Sstevel@tonic-gateinclude ../Makefile.cmd
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gateNCPPFLAGS=	-I$(NATIVE)
317c478bd9Sstevel@tonic-gateROOTTZD=	$(ROOTSHLIB)/zoneinfo
327c478bd9Sstevel@tonic-gateROOTTZSRCD=	$(ROOTSHLIB)/zoneinfo/src
337c478bd9Sstevel@tonic-gateROOTTZTABD=	$(ROOTSHLIB)/zoneinfo/tab
347c478bd9Sstevel@tonic-gateDIRS=  $(ROOTTZSRCD) $(ROOTTZTABD)
357c478bd9Sstevel@tonic-gate
367c478bd9Sstevel@tonic-gateROOTLIBTZSRCFILES=	$(SRCFILES:%=$(ROOTTZSRCD)/%)
377c478bd9Sstevel@tonic-gateROOTLIBTZTABFILES=	$(TABFILES:%=$(ROOTTZTABD)/%)
387c478bd9Sstevel@tonic-gateROOTKSHPROG=	$(ROOTBIN)/$(KSHPROG)
397c478bd9Sstevel@tonic-gate
407c478bd9Sstevel@tonic-gate$(ROOTLIBTZSRCFILES):=	FILEMODE=	0644
417c478bd9Sstevel@tonic-gate$(ROOTLIBTZTABFILES):=	FILEMODE=	0644
427c478bd9Sstevel@tonic-gate
437c478bd9Sstevel@tonic-gate#
447c478bd9Sstevel@tonic-gate# Message catalog
457c478bd9Sstevel@tonic-gate#
467c478bd9Sstevel@tonic-gatePOFILE2=tzselect.po
477c478bd9Sstevel@tonic-gatePOFILE3=zoneinfo.po
487c478bd9Sstevel@tonic-gatePOFILES3=$(TABFILES)
497c478bd9Sstevel@tonic-gateTEXT_DOMAIN2=SUNW_OST_ZONEINFO
507c478bd9Sstevel@tonic-gateMSGDOMAIN2=$(MSGROOT)/$(TEXT_DOMAIN2)
517c478bd9Sstevel@tonic-gate
527c478bd9Sstevel@tonic-gate.KEEP_STATE:
537c478bd9Sstevel@tonic-gate
547c478bd9Sstevel@tonic-gateall: $(PROG) $(NPROG) $(KSHPROG)
557c478bd9Sstevel@tonic-gate
567c478bd9Sstevel@tonic-gate$(PROG): $(OBJS)
577c478bd9Sstevel@tonic-gate	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
587c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
597c478bd9Sstevel@tonic-gate
607c478bd9Sstevel@tonic-gateinstall: all $(DIRS) $(ROOTTZSRCD) $(ROOTTZTABD) $(ROOTUSRSBINPROG) $(ROOTLIBTZSRCFILES) $(ROOTLIBTZTABFILES) $(ROOTKSHPROG)
617c478bd9Sstevel@tonic-gate	$(NPROG) -d $(ROOTTZD) $(TZFILES)
627c478bd9Sstevel@tonic-gate	$(CH) $(CHOWN) -R $(OWNER) $(ROOTTZD)
637c478bd9Sstevel@tonic-gate	$(CH) $(CHGRP) -R $(GROUP) $(ROOTTZD)
647c478bd9Sstevel@tonic-gate
657c478bd9Sstevel@tonic-gate$(NPROG): $(NATIVE) $(NOBJS)
667c478bd9Sstevel@tonic-gate	$(NATIVECC) -o $@ $(NOBJS)
677c478bd9Sstevel@tonic-gate
68*3b3f3420SRussell Blaine#
69*3b3f3420SRussell Blaine# XXX
70*3b3f3420SRussell Blaine# There is a .ksh rule in Makefile.targ, but we need our custom POFILE rules.
71*3b3f3420SRussell Blaine#
72*3b3f3420SRussell Blaine$(KSHPROG):	$(KSHPROG).ksh
73*3b3f3420SRussell Blaine	$(RM) $@
74*3b3f3420SRussell Blaine	$(CAT) $(KSHPROG).ksh > $@
75*3b3f3420SRussell Blaine	$(CHMOD) +x $@
76*3b3f3420SRussell Blaine
777c478bd9Sstevel@tonic-gate$(ROOTTZSRCD)/%: %
787c478bd9Sstevel@tonic-gate	$(INS.file)
797c478bd9Sstevel@tonic-gate
807c478bd9Sstevel@tonic-gate$(ROOTTZTABD)/%: %
817c478bd9Sstevel@tonic-gate	$(INS.file)
827c478bd9Sstevel@tonic-gate
837c478bd9Sstevel@tonic-gate$(DIRS):
847c478bd9Sstevel@tonic-gate	$(INS.dir)
857c478bd9Sstevel@tonic-gate
867c478bd9Sstevel@tonic-gate$(NATIVE):
877c478bd9Sstevel@tonic-gate	-@mkdir -p $@
887c478bd9Sstevel@tonic-gate
897c478bd9Sstevel@tonic-gateclean:
907c478bd9Sstevel@tonic-gate	$(RM) $(OBJS)
917c478bd9Sstevel@tonic-gate
927c478bd9Sstevel@tonic-gatelint: lint_SRCS
937c478bd9Sstevel@tonic-gate
947c478bd9Sstevel@tonic-gate$(NOBJS): $$(@F:.o=.c)
957c478bd9Sstevel@tonic-gate	$(NATIVECC) -O $(NCPPFLAGS) -c -o $@ $(@F:.o=.c)
967c478bd9Sstevel@tonic-gate
977c478bd9Sstevel@tonic-gate$(NATIVE)/zic.o: $(NATIVE)/tzfile.h
987c478bd9Sstevel@tonic-gate
997c478bd9Sstevel@tonic-gate#$(NATIVE)/scheck.o: scheck.c
1007c478bd9Sstevel@tonic-gate#	$(NATIVECC) -c -o $@ scheck.c
1017c478bd9Sstevel@tonic-gate
1027c478bd9Sstevel@tonic-gate#$(NATIVE)/ialloc.o: ialloc.c
1037c478bd9Sstevel@tonic-gate#	$(NATIVECC) -c -o $@ ialloc.c
1047c478bd9Sstevel@tonic-gate
1057c478bd9Sstevel@tonic-gate$(NATIVE)/tzfile.h: $(ROOT)/usr/include/tzfile.h
1067c478bd9Sstevel@tonic-gate	$(RM) $@; cp $(ROOT)/usr/include/tzfile.h $@
1077c478bd9Sstevel@tonic-gate
1087c478bd9Sstevel@tonic-gate#
1097c478bd9Sstevel@tonic-gate# From ../Makefile.targ
1107c478bd9Sstevel@tonic-gate#
1117c478bd9Sstevel@tonic-gateclobber: clean
1127c478bd9Sstevel@tonic-gate	-$(RM) $(PROG) $(CLOBBERFILES)
1137c478bd9Sstevel@tonic-gate
1147c478bd9Sstevel@tonic-gatelint_PROG:
1157c478bd9Sstevel@tonic-gate	$(LINT.c) $(PROG).c $(LDLIBS)
1167c478bd9Sstevel@tonic-gate
1177c478bd9Sstevel@tonic-gatelint_SRCS:
1187c478bd9Sstevel@tonic-gate	$(LINT.c) $(SRCS) $(LDLIBS)
1197c478bd9Sstevel@tonic-gate
1207c478bd9Sstevel@tonic-gate#
1217c478bd9Sstevel@tonic-gate# For message catalogue files
1227c478bd9Sstevel@tonic-gate#
1237c478bd9Sstevel@tonic-gate_msg: $(MSGDOMAIN) $(POFILE) $(POFILE2) $(MSGDOMAIN2) $(POFILE3)
1247c478bd9Sstevel@tonic-gate	$(RM) $(MSGDOMAIN)/$(POFILE)
1257c478bd9Sstevel@tonic-gate	$(CP) $(POFILE) $(MSGDOMAIN)
1267c478bd9Sstevel@tonic-gate	$(RM) $(MSGDOMAIN)/$(POFILE2)
1277c478bd9Sstevel@tonic-gate	$(CP) $(POFILE2) $(MSGDOMAIN)
1287c478bd9Sstevel@tonic-gate	$(RM) $(MSGDOMAIN2)/$(POFILE3)
1297c478bd9Sstevel@tonic-gate	$(CP) $(POFILE3) $(MSGDOMAIN2)/$(POFILE3)
1307c478bd9Sstevel@tonic-gate
1317c478bd9Sstevel@tonic-gate$(MSGDOMAIN) $(DCMSGDOMAIN) $(MSGDOMAIN2):
1327c478bd9Sstevel@tonic-gate	$(INS.dir)
1337c478bd9Sstevel@tonic-gate
1347c478bd9Sstevel@tonic-gate$(POFILE3):	$(POFILES3)
1357c478bd9Sstevel@tonic-gate	$(RM) $@
1367c478bd9Sstevel@tonic-gate	@/bin/sh ./do_pofile.sh > $@
1377c478bd9Sstevel@tonic-gate
138