xref: /illumos-gate/usr/src/cmd/modload/Makefile.com (revision a92282e44f968185a6bba094d1e5fece2da819cf)
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# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# Copyright (c) 2018, Joyent, Inc.
26# Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
27#
28# makefile for loadable module utilities
29
30DRVPROG = add_drv rem_drv update_drv
31MODPROG = modinfo modunload modload
32PROG = $(MODPROG) $(DRVPROG)
33
34include ../../Makefile.cmd
35
36MODCOMMONOBJ = modsubr.o
37MODCOMMONSRC = $(MODCOMMONOBJ:%.o=../%.c)
38
39PLCYOBJ = plcysubr.o
40PLCYSRC = $(PLCYOBJ:%.o=../%.c)
41
42$(PLCYOBJ) := CPPFLAGS += -D_REENTRANT
43
44ROOTDRVPROG = $(DRVPROG:%=$(ROOTUSRSBIN)/%)
45
46DRVCOMMONOBJ = drvsubr.o $(PLCYOBJ)
47DRVCOMMONSRC = $(DRVCOMMONOBJ:%.o=../%.c)
48
49OBJECTS = $(MODCOMMONOBJ) $(DRVCOMMONOBJ) $(PROG:%=%.o)
50SRCS = $(OBJECTS:%.o=../%.c)
51
52COMMONSRC = $(DRVCOMMONSRC) $(MODCOMMONSRC)
53
54CLOBBERFILES = $(PROG)
55
56# install specifics
57
58$(ROOTDRVPROG) := FILEMODE = 0555
59
60add_drv			:= LDLIBS += -ldevinfo -lelf
61rem_drv			:= LDLIBS += -ldevinfo
62update_drv		:= LDLIBS += -ldevinfo
63
64.KEEP_STATE:
65
66%.o:	../%.c
67	$(COMPILE.c) $<
68
69all: $(PROG)
70
71add_drv:	add_drv.o $(DRVCOMMONOBJ)
72	$(LINK.c)  -o $@ add_drv.o $(DRVCOMMONOBJ) $(LDLIBS)
73	$(POST_PROCESS)
74
75rem_drv:	rem_drv.o $(DRVCOMMONOBJ)
76	$(LINK.c)  -o $@ rem_drv.o $(DRVCOMMONOBJ) $(LDLIBS)
77	$(POST_PROCESS)
78
79update_drv:	update_drv.o $(DRVCOMMONOBJ)
80	$(LINK.c)  -o $@ update_drv.o $(DRVCOMMONOBJ) $(LDLIBS)
81	$(POST_PROCESS)
82
83modload:	modload.o $(MODCOMMONOBJ)
84	 $(LINK.c)  -o $@ modload.o $(MODCOMMONOBJ) $(LDLIBS)
85	$(POST_PROCESS)
86
87modunload:	modunload.o $(MODCOMMONOBJ)
88	 $(LINK.c)  -o $@ modunload.o $(MODCOMMONOBJ) $(LDLIBS)
89	$(POST_PROCESS)
90
91modinfo:	modinfo.o $(MODCOMMONOBJ)
92	 $(LINK.c)  -o $@ modinfo.o $(MODCOMMONOBJ) $(LDLIBS)
93	$(POST_PROCESS)
94
95clean:
96	$(RM) $(OBJECTS)
97
98include ../../Makefile.targ
99