📄 makefile
字号:
#Thanks to Bruno Randolf for cleaning up the Makefile
#It should be more extensible now.
KVERSION=`uname -r`
#LOCATE=locate
# if you don't have locate uncomment the line below...it should work.
# you may get alot of permission denied errors...just ignore them.
# find is scouring through every file in /usr/lib...some you'll have
# permission to...some you won't. Hence the error. (David Gervais)
#LOCATE=find /usr/lib | grep
# Select the machine type you wish to compile for
# Your choices are:
# arm
# x86
# mipsel
TARGET:=x86
# These are the options you wish to compile in
# Your choices are:
# -DMESSAGES = Support for printing kernel messages to the console
# -DTRACE = Support for trace messages for debuggin purposes
# -DAODV_GATEWAY = Support for gatewaying to outside networks
# -DAODV_SIGNAL = Support for monitoring the signal strength of neighbors
# -DAODV_MULTICAST = Support for multicasting
AODV_FLAGS := -DMESSAGES -DAODV_GATEWAY -DAODV_SIGNAL
ifeq ($(TARGET),x86)
CC := gcc
LD := ld -m elf_i386 -r
KPATH := /lib/modules/$(KVERSION)/build/include/
MODCFLAGS := -O3 -DMODULE -D__KERNEL__ -DLINUX
endif
ifeq ($(TARGET),arm)
CC := arm-linux-gcc
LD := arm-linux-ld -m armelf -r
KPATH := /home/adhoc/ipaq/include/
MODCFLAGS := -O3 -DMODULE -D__KERNEL__ -DLINUX -DARM
endif
ifeq ($(TARGET),mipsel)
CC := mipsel-linux-gcc
LD := mipsel-linux-ld -r
KPATH := /data/kernel/mips-2_4/include
MODCFLAGS := -O2 -DMODULE -D__KERNEL__ -DLINUX
MODCFLAGS += -Wall -fomit-frame-pointer
MODCFLAGS += -fno-strict-aliasing -G 0 -mno-abicalls -fno-pic
MODCFLAGS += -mips32 -Wa,--trap -pipe -mlong-calls
MODCFLAGS += -DEXPORT_SYMTAB -fno-common -c -finline-limit=5000 -mno-abicalls
endif
COMPILE := $(CC) $(MODCFLAGS) $(AODV_FLAGS) -I$(KPATH)
TARGET_MODDIR := /lib/modules/$(KVERSION)
OBJ := aodv_dev.o aodv_neigh.o aodv_route.o aodv_thread.o flood_id.o hello.o kernel_route.o module.o packet_in.o packet_out.o packet_queue.o rerr.o rrep.o rreq.o signal.o socket.o task_queue.o timer_queue.o utils.o rrep_ack.o
SRC := $(wildcard *.c)
all: kernel_aodv.o
@echo "-----------------------------------------"
@echo ""
@echo "Kernel AODV v2.1"
@echo "Luke Klein-Berndt (kleinb@nist.gov)"
@echo "Wireless Communications Technologies Group"
@echo "National Institute Of Standards and Technology"
%.o: %.c
$(COMPILE) -c $< -o $@
kernel_aodv.o: $(OBJ)
@echo ""
@echo "*** Searching for libgcc.a (Thanks to David Gervais for this routine) ***"
@echo "-----------------------------------------"
@echo "Linking Modules..."
$(LD) -o kernel_aodv.o $(OBJ)
clean:
@echo "Removing all .o files..."
@rm *.o -f
install: kernel_aodv.o
mkdir -p $(DESTDIR)$(TARGET_MODDIR)/net
cp kernel_aodv.o $(DESTDIR)$(TARGET_MODDIR)/net
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -