blob: 865c6183b3cc1e35925ad701bb6379b73ac40654 [file] [log] [blame]
Luis Farias9d66fca2020-05-28 19:01:58 -07001###############################################################################
2#
3# Copyright (c) 2019 Intel.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17###############################################################################
18
19ifdef DPDK_WLS
20ifeq ($(RTE_SDK),)
21$(error "Please define RTE_SDK environment variable")
22endif
23# Default target, can be overridden by command line or environment
24RTE_TARGET ?= x86_64-native-linuxapp-icc
25RTE_OUTPUT = ${PWD}
26
27include $(RTE_SDK)/mk/rte.vars.mk
28SRCS-y := wls_lib_dpdk.c syslib.c
29SHARED = libwls.so
30#CFLAGS +=-Wall -wd9 -DDPDK_WLS
31CFLAGS +=-Wall -DDPDK_WLS -fstack-protector
32EXTRA_CFLAGS +=-g
33include $(RTE_SDK)/mk/rte.extshared.mk
34
35else
36
37obj-m := wls.o
38wls-objs :=syslib.o \
39 wls_drv.o
40
41INSTALL_MOD_DIR ?=/lib/modules/`uname -r`/updates/drivers/intel/wls
42cmd_depmod = /sbin/depmod -a
43EXTRA_CFLAGS +=-g -Wall
44SRC := $(shell pwd)
45
46all:
47 $(MAKE) -C $(KERNEL_SRC) $(EXTRA_CFLAGS) M=$(SRC)
48
49modules_install:
50 $(MAKE) -C $(KERNEL_SRC) $(EXTRA_CFLAGS) M=$(SRC) modules_install
51
52wls_lib.o: wls_lib.c
53 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -D_GNU_SOURCE -g -fPIC -o $@ -c $<
54
55syslib_user.o: syslib.c
56 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -g -fPIC -o $@ -c $<
57
58libwls.so: wls_lib.o syslib_user.o
59 $(CC) $(LDFLAGS) -g -shared -fPIC -Wl,-soname,libwls.so -o $@ wls_lib.o syslib_user.o
60
61install:
62 [ -d "${INSTALL_MOD_DIR}" ] || mkdir -p ${INSTALL_MOD_DIR}
63 cp ./wls.ko ${INSTALL_MOD_DIR}
64 $(call cmd_depmod)
65clean:
66 rm -f *.o *~ core .depend .*.cmd *.ko *.so *.mod.c
67 rm -f Module.markers Module.symvers modules.order
68 rm -rf .tmp_versions Modules.symvers
69endif