ifndef HOSTCC
#
#	Running outside the kernel build.
#

CC	= gcc
CFLAGS	= -O2 -D__KERNEL__ -D__MS32FX_EXEC__ -Wall -Wstrict-prototypes -fomit-frame-pointer -pipe -m486

OBJS = ms32fxCommon.o ms32fxExec.o

# Implicit rules
.SUFFIXE:	.c
.c.o:
	$(CC) -c $(CFLAGS) -o $*.o $<

all::
	make clean
	make dep
	make ms32fxinit
	chmod a-x ms32fxinit
	chmod u+x ms32fxinit

ms32fxinit: $(OBJS)
	$(CC) -o ms32fxinit $(OBJS)

clean:
	rm -f core *~ *.o ms32fxinit

.depend:
	$(CPP) -M -D__KERNEL__ -D__MS32FX_EXEC__ ms32fxCommon.c ms32fxExec.c > .depend
dep:
	make .depend

include	.depend

else

#
#	Running inside the kernel build.
#

include $(TOPDIR)/Rules.make

OBJS = init.o

ifdef CONFIG_LOWLEVEL_SOUND

ifdef CONFIG_ACI_MIXER
OBJS := $(OBJS) aci.o
endif

ifdef CONFIG_MS32FX
OBJS := $(OBJS) ms32fxCommon.o ms32fxKernel.o
endif

endif

all::
	make clean
	make dep
	make lowlevel.o

.depend:
	$(CPP) -M *.c > .depend

dep:
	make .depend

lowlevel.o:	$(OBJS)
	$(LD) -r -o lowlevel.o $(OBJS)

clean:
	rm -f core x y z *~ *.o

include	.depend

endif
