#
# Makefile for MOSIX module.
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#

ifdef CONFIG_MOSIX_MODULE
M_OBJS := mosix.o
SUB_OBJS := balance.o load.o decay.o mem.o mosixmodule.o

$(SUB_OBJS): $(TOPDIR)/include/mosix/config.h

$(TOPDIR)/include/mosix/config.h: $(TOPDIR)/include/linux/autoconf.h
	fgrep _MOSIX $(TOPDIR)/include/linux/autoconf.h > $(TOPDIR)/include/mosix/config.h

mosixmodule.c: increment

increment:
	sh -c 'n=`cat compile.h`; expr 0$$n + 1 > compile.h'

fill.o: fill.S $(TOPDIR)/include/mos/fill.h
	$(CC) -c -o fill.o fill.S

$(M_OBJS): $(SUB_OBJS) fill.o
	$(LD) $(LD_RFLAG) -r -o $(M_OBJS) $(SUB_OBJS) fill.o

else
O_TARGET := mosix.o
O_OBJS   := balance.o load.o decay.o mem.o fill.o

OX_OBJS += mosixmodule.o config.o
endif

include $(TOPDIR)/Rules.make

ifdef CONFIG_MOSIX_MODULE
EXTRA_CFLAGS += "-DIN_MOSIX_MODULE"
endif

$(TOPDIR)/arch/i386/entry.S:
