Luis Farias | 9d66fca | 2020-05-28 19:01:58 -0700 | [diff] [blame] | 1 | ############################################################################### |
| 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 | |
| 19 | ifdef DPDK_WLS |
| 20 | ifeq ($(RTE_SDK),) |
| 21 | $(error "Please define RTE_SDK environment variable") |
| 22 | endif |
| 23 | # Default target, can be overridden by command line or environment |
| 24 | RTE_TARGET ?= x86_64-native-linuxapp-icc |
| 25 | RTE_OUTPUT = ${PWD} |
| 26 | |
| 27 | include $(RTE_SDK)/mk/rte.vars.mk |
| 28 | SRCS-y := wls_lib_dpdk.c syslib.c |
| 29 | SHARED = libwls.so |
| 30 | #CFLAGS +=-Wall -wd9 -DDPDK_WLS |
| 31 | CFLAGS +=-Wall -DDPDK_WLS -fstack-protector |
| 32 | EXTRA_CFLAGS +=-g |
| 33 | include $(RTE_SDK)/mk/rte.extshared.mk |
| 34 | |
| 35 | else |
| 36 | |
| 37 | obj-m := wls.o |
| 38 | wls-objs :=syslib.o \ |
| 39 | wls_drv.o |
| 40 | |
| 41 | INSTALL_MOD_DIR ?=/lib/modules/`uname -r`/updates/drivers/intel/wls |
| 42 | cmd_depmod = /sbin/depmod -a |
| 43 | EXTRA_CFLAGS +=-g -Wall |
| 44 | SRC := $(shell pwd) |
| 45 | |
| 46 | all: |
| 47 | $(MAKE) -C $(KERNEL_SRC) $(EXTRA_CFLAGS) M=$(SRC) |
| 48 | |
| 49 | modules_install: |
| 50 | $(MAKE) -C $(KERNEL_SRC) $(EXTRA_CFLAGS) M=$(SRC) modules_install |
| 51 | |
| 52 | wls_lib.o: wls_lib.c |
| 53 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -D_GNU_SOURCE -g -fPIC -o $@ -c $< |
| 54 | |
| 55 | syslib_user.o: syslib.c |
| 56 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -g -fPIC -o $@ -c $< |
| 57 | |
| 58 | libwls.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 | |
| 61 | install: |
| 62 | [ -d "${INSTALL_MOD_DIR}" ] || mkdir -p ${INSTALL_MOD_DIR} |
| 63 | cp ./wls.ko ${INSTALL_MOD_DIR} |
| 64 | $(call cmd_depmod) |
| 65 | clean: |
| 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 |
| 69 | endif |