From: Gareth H. <ga...@va...> - 2000-11-30 02:04:58
|
I've been doing a whole bunch of work on things like optimized lighting, VB rendering, texture image conversion and so on. Instead of going through the nightmare of manually working out the offsets for the various structures used, I wrote a little app that takes definitions from mtypes.h etc and convertes them into byte offsets. It outputs a header file which can be included by all the asm files. Very similar to what Glide does for its asm code. The way I'm handling this at the moment is a bit of a hack -- I've added "GENERATED_SOURCES = X86/asm_types.h" to Make-config where appropriate, and included the following rule in src/Makefile.X11: X86/asm_types.h: types.h vb.h X86/gen_types.c $(CC) -I. -I$(INCDIR) $(CFLAGS) X86/gen_types.c -o X86/gen_types ./X86/gen_types > X86/asm_types.h rm -f X86/gen_types I then added GENERATED_SOURCES before OBJECTS when building the library: $(LIBDIR)/$(GL_LIB): $(GENERATED_SOURCES) $(OBJECTS) $(MAKELIB) $(GL_LIB) $(GL_MAJOR) $(GL_MINOR) $(GL_TINY) $(OBJECTS) rm -f $(LIBDIR)/$(GL_LIB)* mv $(GL_LIB)* $(LIBDIR) Hey, it works ;-) This is certainly not the cleanest way to handle generated files, especially when they depend on other source files and can't be generated from scripts (easily, anyway). I'm assuming it will be much easier to do this with an autoconf build system. A couple of questions then: - Does anyone have a better way of handling this for the old-style Makefiles? - My plan was to just include gen_types.c in CVS and generate asm_types.h as needed. Is this the best idea? Should the DRI copy of Mesa have asm_types.h, or should it generate it as well? - Anyone have strong objections to committing it as it stands now? -- Gareth |