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