xref: /titanic_50/usr/src/cmd/zic/Makefile (revision 275c9da86e89f8abf71135cf63d9fc23671b2e60)
1#
2#ident	"%Z%%M%	%I%	%E% SMI"
3#
4# Copyright (c) 1989-2001 by Sun Microsystems, Inc.
5# All rights reserved.
6#
7
8NATIVE=native
9PROG= zic
10KSHPROG= tzselect
11NPROG= $(NATIVE)/$(PROG)
12
13# "etcetera" must be listed before "backward" because it sets up links that
14# "backward" needs.
15TZFILES= africa antarctica asia australasia etcetera europe \
16	 factory northamerica pacificnew solar87 solar88 solar89 \
17	 southamerica backward
18# Don't build the systemv timezones, but do install the source file.
19SRCFILES = $(TZFILES) systemv README
20TABFILES = continent.tab country.tab zone_sun.tab
21
22OBJS= zic.o scheck.o ialloc.o
23SRCS= $(OBJS:%.o=%.c)
24NOBJS= $(OBJS:%=$(NATIVE)/%)
25OWNER= root
26GROUP= bin
27
28CLOBBERFILES= $(NOBJS) $(NPROG) $(NATIVE)/zic.c $(NATIVE)/tzfile.h
29
30include ../Makefile.cmd
31
32NCPPFLAGS=	-I$(NATIVE)
33ROOTTZD=	$(ROOTSHLIB)/zoneinfo
34ROOTTZSRCD=	$(ROOTSHLIB)/zoneinfo/src
35ROOTTZTABD=	$(ROOTSHLIB)/zoneinfo/tab
36DIRS=  $(ROOTTZSRCD) $(ROOTTZTABD)
37
38ROOTLIBTZSRCFILES=	$(SRCFILES:%=$(ROOTTZSRCD)/%)
39ROOTLIBTZTABFILES=	$(TABFILES:%=$(ROOTTZTABD)/%)
40ROOTKSHPROG=	$(ROOTBIN)/$(KSHPROG)
41
42$(ROOTLIBTZSRCFILES):=	FILEMODE=	0644
43$(ROOTLIBTZTABFILES):=	FILEMODE=	0644
44
45#
46# Message catalog
47#
48POFILE2=tzselect.po
49POFILE3=zoneinfo.po
50POFILES3=$(TABFILES)
51TEXT_DOMAIN2=SUNW_OST_ZONEINFO
52MSGDOMAIN2=$(MSGROOT)/$(TEXT_DOMAIN2)
53
54.KEEP_STATE:
55
56all: $(PROG) $(NPROG) $(KSHPROG)
57
58$(PROG): $(OBJS)
59	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
60	$(POST_PROCESS)
61
62install: all $(DIRS) $(ROOTTZSRCD) $(ROOTTZTABD) $(ROOTUSRSBINPROG) $(ROOTLIBTZSRCFILES) $(ROOTLIBTZTABFILES) $(ROOTKSHPROG)
63	$(NPROG) -d $(ROOTTZD) $(TZFILES)
64	$(CH) $(CHOWN) -R $(OWNER) $(ROOTTZD)
65	$(CH) $(CHGRP) -R $(GROUP) $(ROOTTZD)
66
67$(NPROG): $(NATIVE) $(NOBJS)
68	$(NATIVECC) -o $@ $(NOBJS)
69
70#
71# XXX
72# There should be a .ksh rule in default.mk.  Until there is, we
73# do it by hand.
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