Source

ip-noise / C / arbitrator / Makefile.kernel

Full commit

all: ip-noise-arb.o

INCLUDES = conn.h delayer.h fcs_dm.h iface.h packet_logic.h pqueue.h queue.h rand.h read.h redblack.h rwlock.h switcher.h text_queue_in.h text_queue_out.h verdict.h 

OBJECTS_PROTO = conn.o delayer.o fcs_dm.o ip_queue.o k_stdlib.o main.o packet_logic.o pqueue.o queue.o rand.o redblack.o rwlock.o str2int_dict.o switcher.o text_queue_in.o text_queue_out.o

#CFLAGS = -DUSE_TEXT_QUEUE_IN -DUSE_TEXT_QUEUE_OUT -D__KERNEL__ -DMODULE -DLINUX -I/usr/src/linux/include/ -g -Wall
UML = 1

DEBUG = 0

I386 = 1


ifeq ($(DEBUG),1)
	OPT_FLAGS = -g -O2
else
	OPT_FLAGS = -O2
endif

COMMON_FLAGS_PRE = $(OPT_FLAGS) -Wall

COMMON_FLAGS_POST = -DMODULE -D__KERNEL__ -DUSE_TEXT_QUEUE_IN -DUSE_TEXT_QUEUE_OUT 

ifeq ($(UML),1)
	UML_BASE_DIR = /home/shlomi/Download/unpack/kernel/User-Mode-Linux/kernel/linux
	#UML_BASE_DIR = /home/project/Download/unpack/User-Mode-Linux/kernel/linux
	#UML_BASE_DIR = /home/project/Download/unpack/User-Mode-Linux/kernel/2.4.9/linux
	CFLAGS = $(COMMON_FLAGS_PRE) -I$(UML_BASE_DIR)/include -I$(UML_BASE_DIR)/arch/um/include -U__i386__ -DUM_FASTCALL -DNESTING=0 -D__arch_um__ -DSUBARCH="i386" $(COMMON_FLAGS_POST)
else
	CFLAGS = $(COMMON_FLAGS_PRE) -I/usr/src/linux/include $(COMMON_FLAGS_POST)
endif

$(OBJECTS_PROTO) :: %.o : %.c $(INCLUDES)
	kgcc $(CFLAGS) -c $<

iface.o: iface.c iface_handlers.c $(INCLUDES)
	kgcc $(CFLAGS) -c iface.c


ifeq ($(I386),1)

e_log.o: e_log.s
	kgcc -c $<

endif

portable_log.o: portable_log.c
	kgcc $(CFLAGS) -c $<

OBJECTS = $(OBJECTS_PROTO) iface.o

ifeq ($(I386),1)
	OBJECTS_WITH_LOG = $(OBJECTS) e_log.o
else
	OBJECTS_WITH_LOG = $(OBJECTS) portable_log.o
endif

ip-noise-arb.o: $(OBJECTS_WITH_LOG)
	ld -r -o $@ $(OBJECTS_WITH_LOG)

clean:
	rm -f arb $(OBJECTS_WITH_LOG)