xref: /illumos-gate/usr/src/cmd/zic/Makefile (revision 406fc5100dac8d225a315a6def6be8d628f34e24)
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) $(NATIVE_CFLAGS) -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 $(NATIVE_CFLAGS) $(NCPPFLAGS) -c -o $@ $(@F:.o=.c)
99
100$(NATIVE)/zic.o: $(NATIVE)/tzfile.h
101
102$(NATIVE)/tzfile.h: $(ROOT)/usr/include/tzfile.h
103	$(RM) $@; cp $(ROOT)/usr/include/tzfile.h $@
104
105#
106# From ../Makefile.targ
107#
108clobber: clean
109	-$(RM) $(PROG) $(CLOBBERFILES)
110
111lint_PROG:
112	$(LINT.c) $(PROG).c $(LDLIBS)
113
114lint_SRCS:
115	$(LINT.c) $(SRCS) $(LDLIBS)
116
117#
118# For message catalogue files
119#
120_msg: $(MSGDOMAIN) $(POFILE) $(POFILE2) $(MSGDOMAIN2) $(POFILE3)
121	$(RM) $(MSGDOMAIN)/$(POFILE)
122	$(CP) $(POFILE) $(MSGDOMAIN)
123	$(RM) $(MSGDOMAIN)/$(POFILE2)
124	$(CP) $(POFILE2) $(MSGDOMAIN)
125	$(RM) $(MSGDOMAIN2)/$(POFILE3)
126	$(CP) $(POFILE3) $(MSGDOMAIN2)/$(POFILE3)
127
128$(MSGDOMAIN) $(DCMSGDOMAIN) $(MSGDOMAIN2):
129	$(INS.dir)
130
131$(POFILE3):	$(POFILES3)
132	$(RM) $@
133	@/bin/sh ./do_pofile.sh > $@
134
135