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 (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
23#
24# Copyright (c) 2018, Joyent, Inc.
25
26# Needed for ROOTFS_LIBDIR definition
27include		../../../../lib/Makefile.lib
28
29PROG=		nwamd
30OBJS=		conditions.o dlpi_events.o door_if.o enm.o\
31		events.o known_wlans.o llp.o loc.o logging.o\
32		main.o ncp.o ncu.o ncu_phys.o ncu_ip.o objects.o\
33		routing_events.o sysevent_events.o util.o
34SRCS=		$(OBJS:%.o=%.c)
35HEADERS=	conditions.h events.h known_wlans.h llp.h ncp.h ncu.h\
36		objects.h
37LOCFILES=	create_loc_auto create_loc_nonet
38NONETLOCFILES=	ipf.conf.dfl ipf6.conf.dfl
39
40ROOTCFGDIR=	$(ROOTETC)/nwam
41ROOTLOCDIR=	$(ROOTCFGDIR)/loc
42NONETLOCDIR=	$(ROOTLOCDIR)/NoNet
43LOCDIRS=	$(NONETLOCDIR)
44ROOTCFGFILES=	$(LOCFILES:%=$(ROOTLOCDIR)/%) \
45		$(NONETLOCFILES:%=$(NONETLOCDIR)/%)
46
47include		../../../Makefile.cmd
48
49$(ROOTCFGFILES) := FILEMODE= 644
50
51ROOTCMDDIR=	$(ROOTFS_LIBDIR)/inet
52
53LDLIBS +=	-ldhcpagent -ldhcputil -ldladm -ldlpi -lgen \
54		-linetutil -lipadm -lkstat -lnsl -lnvpair -lnwam \
55		-lsecdb -lscf -lsocket -lsysevent -lumem -luutil
56
57CERRWARN +=	-_gcc=-Wno-parentheses
58CERRWARN +=	-_gcc=-Wno-switch
59CERRWARN +=	-_gcc=-Wno-unused-label
60
61# not linted
62SMATCH=off
63
64#
65# Instrument with CTF data to ease debugging.
66#
67CTFCONVERT_HOOK = && $(CTFCONVERT_O)
68CTFMERGE_HOOK = && $(CTFMERGE) -L VERSION -o $@ $(OBJS)
69$(OBJS) := CFLAGS += $(CTF_FLAGS)
70
71.KEEP_STATE:
72
73.PARALLEL:
74
75all: $(PROG)
76
77$(PROG): $(OBJS)
78	$(LINK.c) $(OBJS) -o $@ $(LDLIBS) $(CTFMERGE_HOOK)
79	$(POST_PROCESS)
80
81install: $(ROOTCMD) $(ROOTLOCDIR) $(ROOTCFGFILES)
82
83check:  $(SRCS) $(HEADERS)
84	$(CSTYLE) -cpP $(SRCS) $(HEADERS)
85
86$(ROOTCMD): all
87
88clean:
89	$(RM) $(OBJS)
90
91$(ROOTCFGDIR):
92	$(INS.dir)
93
94$(ROOTLOCDIR): $(ROOTCFGDIR)
95	$(INS.dir)
96
97$(LOCDIRS): $(ROOTLOCDIR)
98	$(INS.dir)
99
100$(ROOTLOCDIR)/%: $(ROOTLOCDIR) %
101	$(INS.file)
102
103$(NONETLOCDIR)/%: $(NONETLOCDIR) %
104	$(INS.file)
105
106include		../../../Makefile.targ
107