xref: /titanic_52/usr/src/cmd/zic/Makefile (revision 0bb073995ac5a95bd35f2dd790df1ea3d8c2d507)
1#
2# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
3# Use is subject to license terms.
4#
5
6NATIVE=native
7PROG= zic
8KSHPROG= tzselect
9NPROG= $(NATIVE)/$(PROG)
10
11# "etcetera" must be listed before "backward" because it sets up links that
12# "backward" needs.
13TZFILES= africa antarctica asia australasia etcetera europe \
14	 factory northamerica pacificnew solar87 solar88 solar89 \
15	 southamerica backward
16# Don't build the systemv timezones, but do install the source file.
17SRCFILES = $(TZFILES) systemv README
18TABFILES = continent.tab country.tab zone_sun.tab
19
20OBJS= zic.o scheck.o ialloc.o
21SRCS= $(OBJS:%.o=%.c)
22NOBJS= $(OBJS:%=$(NATIVE)/%)
23OWNER= root
24GROUP= bin
25
26CLOBBERFILES= $(NOBJS) $(KSHPROG) $(NPROG) $(NATIVE)/zic.c $(NATIVE)/tzfile.h
27
28include ../Makefile.cmd
29
30NCPPFLAGS=	-I$(NATIVE)
31ROOTTZD=	$(ROOTSHLIB)/zoneinfo
32ROOTTZSRCD=	$(ROOTSHLIB)/zoneinfo/src
33ROOTTZTABD=	$(ROOTSHLIB)/zoneinfo/tab
34DIRS=  $(ROOTTZSRCD) $(ROOTTZTABD)
35
36ROOTLIBTZSRCFILES=	$(SRCFILES:%=$(ROOTTZSRCD)/%)
37ROOTLIBTZTABFILES=	$(TABFILES:%=$(ROOTTZTABD)/%)
38ROOTKSHPROG=	$(ROOTBIN)/$(KSHPROG)
39
40$(ROOTLIBTZSRCFILES):=	FILEMODE=	0644
41$(ROOTLIBTZTABFILES):=	FILEMODE=	0644
42
43#
44# Message catalog
45#
46POFILE2=tzselect.po
47POFILE3=zoneinfo.po
48POFILES3=$(TABFILES)
49TEXT_DOMAIN2=SUNW_OST_ZONEINFO
50MSGDOMAIN2=$(MSGROOT)/$(TEXT_DOMAIN2)
51
52.KEEP_STATE:
53
54all: $(PROG) $(NPROG) $(KSHPROG)
55
56$(PROG): $(OBJS)
57	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
58	$(POST_PROCESS)
59
60install: all $(DIRS) $(ROOTTZSRCD) $(ROOTTZTABD) $(ROOTUSRSBINPROG) $(ROOTLIBTZSRCFILES) $(ROOTLIBTZTABFILES) $(ROOTKSHPROG)
61	$(NPROG) -d $(ROOTTZD) $(TZFILES)
62	$(CH) $(CHOWN) -R $(OWNER) $(ROOTTZD)
63	$(CH) $(CHGRP) -R $(GROUP) $(ROOTTZD)
64
65$(NPROG): $(NATIVE) $(NOBJS)
66	$(NATIVECC) -o $@ $(NOBJS)
67
68#
69# XXX
70# There is a .ksh rule in Makefile.targ, but we need our custom POFILE rules.
71#
72$(KSHPROG):	$(KSHPROG).ksh
73	$(RM) $@
74	$(CAT) $(KSHPROG).ksh > $@
75	$(CHMOD) +x $@
76
77$(ROOTTZSRCD)/%: %
78	$(INS.file)
79
80$(ROOTTZTABD)/%: %
81	$(INS.file)
82
83$(DIRS):
84	$(INS.dir)
85
86$(NATIVE):
87	-@mkdir -p $@
88
89clean:
90	$(RM) $(OBJS)
91
92lint: lint_SRCS
93
94$(NOBJS): $$(@F:.o=.c)
95	$(NATIVECC) -O $(NCPPFLAGS) -c -o $@ $(@F:.o=.c)
96
97$(NATIVE)/zic.o: $(NATIVE)/tzfile.h
98
99#$(NATIVE)/scheck.o: scheck.c
100#	$(NATIVECC) -c -o $@ scheck.c
101
102#$(NATIVE)/ialloc.o: ialloc.c
103#	$(NATIVECC) -c -o $@ ialloc.c
104
105$(NATIVE)/tzfile.h: $(ROOT)/usr/include/tzfile.h
106	$(RM) $@; cp $(ROOT)/usr/include/tzfile.h $@
107
108#
109# From ../Makefile.targ
110#
111clobber: clean
112	-$(RM) $(PROG) $(CLOBBERFILES)
113
114lint_PROG:
115	$(LINT.c) $(PROG).c $(LDLIBS)
116
117lint_SRCS:
118	$(LINT.c) $(SRCS) $(LDLIBS)
119
120#
121# For message catalogue files
122#
123_msg: $(MSGDOMAIN) $(POFILE) $(POFILE2) $(MSGDOMAIN2) $(POFILE3)
124	$(RM) $(MSGDOMAIN)/$(POFILE)
125	$(CP) $(POFILE) $(MSGDOMAIN)
126	$(RM) $(MSGDOMAIN)/$(POFILE2)
127	$(CP) $(POFILE2) $(MSGDOMAIN)
128	$(RM) $(MSGDOMAIN2)/$(POFILE3)
129	$(CP) $(POFILE3) $(MSGDOMAIN2)/$(POFILE3)
130
131$(MSGDOMAIN) $(DCMSGDOMAIN) $(MSGDOMAIN2):
132	$(INS.dir)
133
134$(POFILE3):	$(POFILES3)
135	$(RM) $@
136	@/bin/sh ./do_pofile.sh > $@
137
138