Makefile.template revision 8260e9a8217bf003f490b17cbd9df93bf0cc6675
1# src/gallium/Makefile.template 2 3# Template makefile for gallium libraries. 4# 5# Usage: 6# The minimum that the including makefile needs to define 7# is TOP, LIBNAME and one of of the *_SOURCES. 8# 9# Optional defines: 10# LIBRARY_INCLUDES are appended to the list of includes directories. 11# LIBRARY_DEFINES is not used for makedepend, but for compilation. 12 13### Basic defines ### 14 15OBJECTS = $(C_SOURCES:.c=.o) \ 16 $(CPP_SOURCES:.cpp=.o) \ 17 $(ASM_SOURCES:.S=.o) 18 19INCLUDES = \ 20 -I. \ 21 -I$(TOP)/src/gallium/include \ 22 -I$(TOP)/src/gallium/auxiliary \ 23 -I$(TOP)/src/gallium/drivers \ 24 $(LIBRARY_INCLUDES) 25 26 27##### TARGETS ##### 28 29default: depend lib$(LIBNAME).a $(PROGS) 30 31lib$(LIBNAME).a: $(OBJECTS) $(EXTRA_OBJECTS) Makefile $(TOP)/src/gallium/Makefile.template 32 $(MKLIB) -o $(LIBNAME) -static $(OBJECTS) $(EXTRA_OBJECTS) 33 34depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(SYMLINKS) $(GENERATED_SOURCES) 35 rm -f depend 36 touch depend 37 $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(GENERATED_SOURCES) 2> /dev/null 38 39$(PROGS): % : %.o 40 $(LD) $(filter %.o,$^) -o $@ -Wl,--start-group $(LIBS) -Wl,--end-group 41 42# Emacs tags 43tags: 44 etags `find . -name \*.[ch]` `find $(TOP)/src/gallium/include -name \*.h` 45 46# Remove .o and backup files 47clean: 48 rm -f $(OBJECTS) $(GENERATED_SOURCES) $(PROGS) lib$(LIBNAME).a depend depend.bak 49 50# Dummy target 51install: 52 @echo -n "" 53 54##### RULES ##### 55 56%.s: %.c 57 $(CC) -S $(INCLUDES) $(CFLAGS) $(LIBRARY_DEFINES) $< -o $@ 58 59%.o: %.c 60 $(CC) -c $(INCLUDES) $(CFLAGS) $(LIBRARY_DEFINES) $< -o $@ 61 62%.o: %.cpp 63 $(CXX) -c $(INCLUDES) $(CXXFLAGS) $(LIBRARY_DEFINES) $< -o $@ 64 65%.o: %.S 66 $(CC) -c $(INCLUDES) $(CFLAGS) $(LIBRARY_DEFINES) $< -o $@ 67 68 69sinclude depend 70