2 # Acess2 Module/Driver Templater Makefile
5 _CPPFLAGS := $(CPPFLAGS)
7 -include $(dir $(lastword $(MAKEFILE_LIST)))../Makefile.cfg
9 CPPFLAGS := -I$(ACESSDIR)/Kernel/include -I$(ACESSDIR)/Kernel/arch/$(ARCHDIR)/include -DARCH=$(ARCH) $(_CPPFLAGS)
10 CFLAGS := -Wall -Werror -fno-stack-protector -g -O3 -fno-builtin
13 FULLNAME := $(CATEGORY)_$(NAME)
18 CPPFLAGS += -D_MODULE_NAME_=\"$(FULLNAME)\"
20 ifneq ($(BUILDTYPE),static)
21 _SUFFIX := dyn_$(ARCH)
22 BIN := ../$(FULLNAME).kmd.$(ARCH)
23 CFLAGS += $(DYNMOD_CFLAGS) -fPIC
26 CFLAGS += $(KERNEL_CFLAGS)
27 BIN := ../$(NAME).xo.$(ARCH)
30 OBJ := $(addsuffix .$(_SUFFIX),$(OBJ))
32 DEPFILES := $(filter %.o.$(_SUFFIX),$(OBJ))
33 DEPFILES := $(DEPFILES:%.o.$(_SUFFIX)=%.d.$(ARCH))
40 $(RM) $(BIN) $(BIN).dsm $(KOBJ) $(OBJ) $(DEPFILES) $(EXTRA)
43 ifneq ($(BUILDTYPE),static)
44 @$(xMKDIR) $(DISTROOT)/Modules/$(ARCH); true
45 $(xCP) $(BIN) $(DISTROOT)/Modules/$(ARCH)/$(NAME).kmd
49 ifneq ($(BUILDTYPE),static)
50 $(BIN): %.kmd.$(ARCH): $(OBJ)
52 # @$(LD) -T $(ACESSDIR)/Modules/link.ld --allow-shlib-undefined -shared -nostdlib -o $@ $(OBJ)
53 @$(LD) --allow-shlib-undefined -shared -nostdlib -o $@ $(OBJ) -defsym=DriverInfo=_DriverInfo_$(FULLNAME)
54 @$(DISASM) $(BIN) > $(BIN).dsm
56 $(BIN): %.xo.$(ARCH): $(OBJ)
58 @$(LD) -r -o $@ $(OBJ)
61 %.o.$(_SUFFIX): %.c Makefile $(CFGFILES)
63 @$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
64 @$(CC) -M $(CPPFLAGS) -MT $@ -o $*.d.$(ARCH) $<