# Update to point to your raw-device-enabled kernel source tree's include
# directory

INCLUDE=/u2/src/linux-2.1.131-dev/include

OBJS = setattr.o getattr.o fsattr.o
POBJS = setattr.po getattr.po fsattr.o

# By default, don't install the .so file, so that code using setattr
# doesn't have to assume that the host system has this obscure little
# library installed.
INSTALL = libsetattr.a

%.o: %.c
	gcc -I$(INCLUDE) -c -o $@ $<

%.po: %.c
	gcc -fpic -I$(INCLUDE) -c -o $@ $<

all: libsetattr.a libsetattr.so

libsetattr.so: $(POBJS)
	gcc -shared -o $@ $^

libsetattr.a: libsetattr.a($(OBJS))

install:
	install $(INSTALL) /usr/lib
	install setattr.h /usr/include

%.o %.po: setattr.h

clean:
	rm -f *.o *.po *.so *.a

spotless: clean
	rm -f *~
