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