#
# Copyright (C) 1998 David A. Hinds -- dhinds@pcmcia.sourceforge.org
#
# Makefile 1.6 2000/04/29 02:00:34
#
# Adapted for AirPort driver by Ben. Herrenschmidt
#

TOPDIR := $(shell cd ..; pwd)

# Don't remove "-O3" or bad things will happen!
CFLAGS = -O3 -Wall -Wstrict-prototypes -pipe
CPPFLAGS += -D__KERNEL__ -DMODULE -D__linux__ -I$(TOPDIR)/include

CC += -fno-builtin -msoft-float -ffixed-r2

XFLAGS = $(CFLAGS) $(CPPFLAGS)

MODULES = airport.o
SRCS    = airport.c wvlan_hcf.c wvlan_hcfio.c \

all:	$(MODULES)

wvlan_hcf.o wvlan_hcfio.o: %.o: %.c
	$(CC) -MD -c $(XFLAGS) $<
	@mkdir -p .depfiles ; mv $*.d .depfiles

airport.o: airport.c wvlan_hcf.o wvlan_hcfio.o
	$(CC) -c -MD $(CFLAGS) $(CPPFLAGS) $< -o .$@
	@mkdir -p .depfiles ; mv $*.d .depfiles
	$(LD) -r -o $@ .$@ wvlan_hcf.o wvlan_hcfio.o
	rm -f .$@ ; chmod -x $@

clean:
	rm -f core core.* *.o .*.o *.s *.a *~ .depend .depfiles/*.d

COFLAGS = -kv
YFLAGS = -d

%.c %.h : %.y
	$(YACC) $(YFLAGS) $<
	mv y.tab.c $*.c
	mv y.tab.h $*.h

%.s : %.c
	$(CC) $(CFLAGS) $(CPPFLAGS) -S $<

# Stuff to automatically maintain dependency files

%.o : %.c
	$(CC) -MD $(CFLAGS) $(CPPFLAGS) -c $<
	@mkdir -p .depfiles ; mv $*.d .depfiles

-include $(SRCS:%.c=.depfiles/%.d)
