# To build debug version use nodebug=0
# Release version is built by default
ifndef nodebug
nodebug=1
endif

ifndef TARGET
TARGET := $(shell uname -m)
endif

ifeq ($(nodebug), 1)
#Release
 ccflags-y += -DNDEBUG
 UFSD_LIB  = ./objfre/libufsd_$(TARGET).o
else
#Debug
 ccflags-y += -O1 -DUFSD_DEBUG
 UFSD_LIB  = ./objchk/libufsd_$(TARGET).o
endif
#ccflags-y += -fstrict-aliasing -Wstrict-aliasing
ccflags-y += -DUFSD_DEVICE=ufsd
ccflags-y += -include /ufsd/mam/ifslinux2/fs_conf.h
#ccflags-y += -DUFSD_USE_ASM_DIV64
#ccflags-y += -DUFSD_SMART_DIRTY_SEC=0
#ccflags-y += -save-temps
ccflags-y += -Wfatal-errors -Wno-unused-local-typedefs
ccflags-y += $(call cc-disable-warning,date-time)
ccflags-y += -Wall -Werror
ccflags-y += -Wno-expansion-to-defined

# $(IFS_O) should be first to correct show module address
ufsd-objs := ufsdvfs.o vfsdebug.o
jnl-objs  := ufsdjnl.o

#obj-m     := ufsd.o
#obj-m     := jnl.o
obj-m     := jnl.o ufsd.o
ufsd-y    := ufsdvfs.o vfsdebug.o $(UFSD_LIB)
jnl-y     := ufsdjnl.o
LDFLAGS   += -s -O2 -d -x -X
