#
## Makefile for the SAR Library
#

include /usr/src/linux/.config

# you can add -DCRCASM to get better performance
CFLAGS := -O2 -Wstrict-prototypes  -fomit-frame-pointer -fno-strict-aliasing -pipe -fno-strength-reduce -Wall -D__KERNEL__ -DLINUX

INCLUDES := -I/usr/src/linux/include/ -I/usr/include/

VERSION = $(shell cat VERSION)
SHORTVERSION = $(shell cat VERSION | cut -d '.' -f 1-2)
# parse kernel options

ifdef CONFIG_SMP
	CFLAGS += -D__SMP__
endif

all: normal debug

normal: sarlib.o 

debug: sarlibdbg.o

%.o : %.c %.h Makefile
	$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@

%dbg.o : %.c %.h Makefile
	$(CC) $(CFLAGS) $(INCLUDES) -DDEBUG -c $< -o $@

package: clean
	(cd ..; rm sarlib-$(VERSION); ln -s sarlib-$(SHORTVERSION) sarlib-$(VERSION); tar zcvfh sarlib-$(VERSION).tgz sarlib-$(VERSION)/);

clean:
	/bin/rm -f *.o