CC = gcc
# NOTE: -O2, -O3 and -Os are borked
CFLAGS = -O1 -Wall
CPPFLAGS =
#CPPFLAGS+= -DZDM
AR = ar
OBJS = au.o ac97_def.o dpmi_c.o mdma.o pcibios.o sc_cmi.o sc_e1371.o sc_ich.o sc_inthd.o sc_sbl24.o sc_sbliv.o sc_sbxfi.o sc_via82.o tim.o
# __udivdi3() is generated for the uint64 division in tim.c.
# use a local x86 asm version from llvm compiler_rt project,
# instead of making the dxe to rely on libgcc symbols..
DXE_OBJS = udivdi3.o

all: libau.a sndpci.dxe

libau.a:	$(OBJS)
	$(AR) rs libau.a $(OBJS)

sndpci.dxe: $(OBJS) $(DXE_OBJS)
	-dxe3gen -o sndpci.dxe -E _AU_ -U $(OBJS) $(DXE_OBJS)

clean:
	rm -f *.o
distclean: clean
	rm -f *.a *.dxe

%.o : %.c
	$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
%.o : %.S
	$(CC) $(CFLAGS) $(CPPFLAGS) -x assembler-with-cpp -c $< -o $@
