# eset_wap (ESET Web Access Protection module)
# Copyright (C) 1992-2025 ESET, spol. s r.o.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
#
# In case of any questions, you can contact us at ESET, spol. s r.o., Einsteinova 24, 851 01 Bratislava, Slovakia.

default: all

BLD_DIR ?= $(PWD)/build

# linux kernel module targets

MDIR := $(BLD_DIR)/modules/
KDIR ?= /lib/modules/`uname -r`/build

# module include directories

modules:
	$(MAKE) -C $(KDIR) M=$(PWD) EXTRA_CFLAGS=$(FLAGS) modules

modules_debug:
	$(MAKE) -C $(KDIR) M=$(PWD) EXTRA_CFLAGS='-g -Wall -DEWAP_DEBUG $(FLAGS)' modules

modules_clean:
	$(MAKE) -C $(KDIR) M=$(PWD) clean

# user-space library targets

LIB_DIR ?= $(BLD_DIR)/lib
HDR_DIR ?= $(BLD_DIR)/include

export INCLUDE LIB_DIR BIN_DIR HDR_DIR BLD_DIR

# general targes

all: modules

all_debug: modules_debug

clean: modules_clean