#
# Copyright (c) nVidia Corporation
#

all: 
	@echo "making gart"

# Installation
TARGETDIR = /usr/src/nvidia/nvgart
PATCHES = \
	linux-2.4.20-agpgart.diff \
	linux-2.4.21-agpgart.diff \
	linux-2.4.21-102-agpgart.diff \
	linux-2.4.21-4.EL-agpgart.diff \
	linux-2.4.22-agpgart.diff \
	$(NULL)

# Do fake install if not root (needed for building rpms)
install:
	mkdir -p $(INSTROOT)/$(TARGETDIR)
ifeq  "$(UID)" "0"
	for patch in $(PATCHES); do \
	  install -b -m 644 -o root $$patch $(INSTROOT)/$(TARGETDIR); \
	done
	install -b -m 644 -o root README $(INSTROOT)/$(TARGETDIR)
else
	for patch in $(PATCHES); do \
	  install -b -m 644 $$patch $(INSTROOT)/$(TARGETDIR); \
	done
	install -b -m 644 README $(INSTROOT)/$(TARGETDIR)
endif # uid is root

uninstall:
	for patch in $(PATCHES); do \
	  rm -f $(TARGETDIR)/$$patch; \
	done

clean:
	rm -f *.o *~ core
