xref: /illumos-gate/usr/src/cmd/init/Makefile (revision ddb365bfc9e868ad24ccdcb0dc91af18b10df082)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21
22#
23# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# Copyright (c) 2018, Joyent, Inc.
27# Copyright 2020 Oxide Computer Company
28# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
29
30PROG= init
31ROOTFS_PROG= $(PROG)
32
33DEFAULTFILES= init.dfl
34
35include ../Makefile.cmd
36
37OBJS = init.o bootbanner.o definit.o
38CSTD = $(CSTD_GNU99)
39LDLIBS += -lpam -lbsm -lcontract -lscf
40CERRWARN += -_gcc=-Wno-parentheses
41CERRWARN += $(CNOWARN_UNINIT)
42CLOBBERFILES= $(STATIC)
43CPPFLAGS += -I$(SRC)/common/definit
44CPPFLAGS += -DBOOTBANNER1='"$(BOOTBANNER1)"'
45CPPFLAGS += -DBOOTBANNER2='"$(BOOTBANNER2)"'
46CPPFLAGS += -DBOOTBANNER3='"$(BOOTBANNER3)"'
47CPPFLAGS += -DBOOTBANNER4='"$(BOOTBANNER4)"'
48CPPFLAGS += -DBOOTBANNER5='"$(BOOTBANNER5)"'
49
50# needs work
51SMATCH=off
52
53.KEEP_STATE:
54
55all: $(ROOTFS_PROG)
56
57install: all $(ROOTETCDEFAULTFILES) $(ROOTSBINPROG)
58	$(RM) $(ROOTETCPROG)
59	$(RM) $(ROOTUSRSBINPROG)
60	$(RM) $(ROOTETC)/telinit
61	$(SYMLINK) ../sbin/$(PROG) $(ROOTETCPROG)
62	$(SYMLINK) ../../sbin/$(PROG) $(ROOTUSRSBINPROG)
63	$(SYMLINK) ../sbin/$(PROG) $(ROOTETC)/telinit
64	$(RM) $(ROOTETC)/TIMEZONE
65	cd $(ROOTETC); $(SYMLINK) default/init TIMEZONE
66
67$(PROG):	$(OBJS)
68	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
69	$(POST_PROCESS)
70
71%.o:	$(SRC)/common/bootbanner/%.c
72	$(COMPILE.c) $<
73	$(POST_PROCESS_O)
74
75%.o:	$(SRC)/common/definit/%.c
76	$(COMPILE.c) $<
77	$(POST_PROCESS_O)
78
79test:
80	rtest $(PROG)
81
82clean:
83	$(RM) $(OBJS)
84
85include ../Makefile.targ
86