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