xref: /titanic_50/usr/src/cmd/zic/Makefile (revision 75eba5b6d79ed4d2ce3daf7b2806306b6b69a938)
1#
2# Copyright 2009 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)/%)
23
24CLOBBERFILES= $(NOBJS) $(KSHPROG) $(NPROG) $(NATIVE)/zic.c $(NATIVE)/tzfile.h
25
26include ../Makefile.cmd
27
28NCPPFLAGS=	-I$(NATIVE)
29ROOTTZD=	$(ROOTSHLIB)/zoneinfo
30ROOTTZSRCD=	$(ROOTSHLIB)/zoneinfo/src
31ROOTTZTABD=	$(ROOTSHLIB)/zoneinfo/tab
32DIRS=  $(ROOTTZSRCD) $(ROOTTZTABD)
33
34CERRWARN +=	-_gcc=-Wno-unused-variable
35CERRWARN +=	-_gcc=-Wno-uninitialized
36
37ROOTLIBTZSRCFILES=	$(SRCFILES:%=$(ROOTTZSRCD)/%)
38ROOTLIBTZTABFILES=	$(TABFILES:%=$(ROOTTZTABD)/%)
39ROOTKSHPROG=	$(ROOTBIN)/$(KSHPROG)
40
41$(ROOTLIBTZSRCFILES):=	FILEMODE=	0644
42$(ROOTLIBTZTABFILES):=	FILEMODE=	0644
43
44#
45# Message catalog
46#
47POFILE2=tzselect.po
48POFILE3=zoneinfo.po
49POFILES3=$(TABFILES)
50TEXT_DOMAIN2=SUNW_OST_ZONEINFO
51MSGDOMAIN2=$(MSGROOT)/$(TEXT_DOMAIN2)
52
53# NB: $(POFILE2) is under SCM.
54CLOBBERFILES += $(POFILE) $(POFILE3)
55
56.KEEP_STATE:
57
58all: $(PROG) $(NPROG) $(KSHPROG)
59
60$(PROG): $(OBJS)
61	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
62	$(POST_PROCESS)
63
64install: all $(DIRS) $(ROOTTZSRCD) $(ROOTTZTABD) $(ROOTUSRSBINPROG) \
65		$(ROOTLIBTZSRCFILES) $(ROOTLIBTZTABFILES) $(ROOTKSHPROG)
66	$(NPROG) -d $(ROOTTZD) $(TZFILES)
67
68$(NPROG): $(NATIVE) $(NOBJS)
69	$(NATIVECC) -o $@ $(NOBJS)
70
71#
72# XXX
73# There is a .ksh rule in Makefile.targ, but we need our custom POFILE rules.
74#
75$(KSHPROG):	$(KSHPROG).ksh
76	$(RM) $@
77	$(CAT) $(KSHPROG).ksh > $@
78	$(CHMOD) +x $@
79
80$(ROOTTZSRCD)/%: %
81	$(INS.file)
82
83$(ROOTTZTABD)/%: %
84	$(INS.file)
85
86$(DIRS):
87	$(INS.dir)
88
89$(NATIVE):
90	-@mkdir -p $@
91
92clean:
93	$(RM) $(OBJS)
94
95lint: lint_SRCS
96
97$(NOBJS): $$(@F:.o=.c)
98	$(NATIVECC) -O $(NCPPFLAGS) -c -o $@ $(@F:.o=.c)
99
100$(NATIVE)/zic.o: $(NATIVE)/tzfile.h
101
102#$(NATIVE)/scheck.o: scheck.c
103#	$(NATIVECC) -c -o $@ scheck.c
104
105#$(NATIVE)/ialloc.o: ialloc.c
106#	$(NATIVECC) -c -o $@ ialloc.c
107
108$(NATIVE)/tzfile.h: $(ROOT)/usr/include/tzfile.h
109	$(RM) $@; cp $(ROOT)/usr/include/tzfile.h $@
110
111#
112# From ../Makefile.targ
113#
114clobber: clean
115	-$(RM) $(PROG) $(CLOBBERFILES)
116
117lint_PROG:
118	$(LINT.c) $(PROG).c $(LDLIBS)
119
120lint_SRCS:
121	$(LINT.c) $(SRCS) $(LDLIBS)
122
123#
124# For message catalogue files
125#
126_msg: $(MSGDOMAIN) $(POFILE) $(POFILE2) $(MSGDOMAIN2) $(POFILE3)
127	$(RM) $(MSGDOMAIN)/$(POFILE)
128	$(CP) $(POFILE) $(MSGDOMAIN)
129	$(RM) $(MSGDOMAIN)/$(POFILE2)
130	$(CP) $(POFILE2) $(MSGDOMAIN)
131	$(RM) $(MSGDOMAIN2)/$(POFILE3)
132	$(CP) $(POFILE3) $(MSGDOMAIN2)/$(POFILE3)
133
134$(MSGDOMAIN) $(DCMSGDOMAIN) $(MSGDOMAIN2):
135	$(INS.dir)
136
137$(POFILE3):	$(POFILES3)
138	$(RM) $@
139	@/bin/sh ./do_pofile.sh > $@
140
141