# Makefile for linux-solo (i.e. stand-alone DRI drivers for miniglx environment)
# We just generate a mesa.a file which is all the core Mesa sources.  This will
# get linked into the DRI hardware drivers (name *_dri.so).


TOP = ../..

include sources

# The objects we want to make:
OBJECTS = \
	$(CORE_OBJECTS) 


##### RULES #####

.c.o:
	$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@

.S.o:
	$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@


x86/matypes.h: main/mtypes.h tnl/t_context.h x86/gen_matypes.c
	$(CC) $(INCLUDE_DIRS) $(CFLAGS) x86/gen_matypes.c -o x86/gen_matypes
	./x86/gen_matypes > x86/matypes.h
	rm -f x86/gen_matypes x86/*.o

x86/common_x86_asm.o: x86/matypes.h



##### TARGETS #####

default:
	@echo "Specify a target configuration"


targets: mesa.a


# Make archive of core object files for linux-solo DRI drivers
mesa.a:	$(OBJECTS)
	rm -f $@
	ar rcv $@ $(OBJECTS)
	ranlib $@



# Run 'make -f Makefile.solo dep' to update the dependencies if you change
# what's included by any source file.
dep: $(CORE_SOURCES) $(ASM_SOURCES)
	makedepend -fdepend -Y $(INCLUDE_DIRS) $(CORE_SOURCES) $(ASM_SOURCES)


# Emacs tags
tags:
	etags `find . -name \*.[ch]` `find ../include`


# Remove .o and backup files
clean:
	-rm -f *.a
	-rm -f */*.o */*~ */*.o */*~
	-rm -f drivers/*/*.o drivers/*/*/*.o


include $(TOP)/Make-config

include depend