X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2FMakefile;h=7a6936e210738121e75a42f4363e74abcf72885a;hb=cd6a31cd4a9ea6deef4778c2eaef2d47240c3a6e;hp=3e0f010671ceff6a9ce2ad823fff3fe1b8bddf8f;hpb=ca12aefdacd22fb42e3f1d3852db4c12de886554;p=mesa.git diff --git a/src/mesa/Makefile b/src/mesa/Makefile index 3e0f010671c..7a6936e2107 100644 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@ -16,9 +16,6 @@ MESA_OBJ_DIR := . ES1_OBJ_DIR := objs-es1 ES2_OBJ_DIR := objs-es2 -MESA_CPPFLAGS := $(API_DEFINES) -ES1_CPPFLAGS := -DFEATURE_ES1=1 -ES2_CPPFLAGS := -DFEATURE_ES2=1 include sources.mak @@ -31,39 +28,66 @@ ES1_GALLIUM_OBJECTS := $(addprefix $(ES1_OBJ_DIR)/, $(MESA_GALLIUM_OBJECTS)) ES2_GALLIUM_OBJECTS := $(addprefix $(ES2_OBJ_DIR)/, $(MESA_GALLIUM_OBJECTS)) MESA_GALLIUM_OBJECTS := $(addprefix $(MESA_OBJ_DIR)/, $(MESA_GALLIUM_OBJECTS)) -# adjust include dirs -MESA_INCLUDES := $(INCLUDE_DIRS) -ES1_INCLUDES := -I$(TOP)/src/mapi/es1api $(INCLUDE_DIRS) -ES2_INCLUDES := -I$(TOP)/src/mapi/es2api $(INCLUDE_DIRS) +# define preprocessor flags +MESA_CPPFLAGS := $(API_DEFINES) $(DEFINES) +ES1_CPPFLAGS := -DFEATURE_ES1=1 $(DEFINES) +ES2_CPPFLAGS := -DFEATURE_ES2=1 $(DEFINES) +# append include dirs +MESA_CPPFLAGS += $(INCLUDE_DIRS) $(TALLOC_CFLAGS) +ES1_CPPFLAGS += -I$(TOP)/src/mapi/es1api $(INCLUDE_DIRS) +ES2_CPPFLAGS += -I$(TOP)/src/mapi/es2api $(INCLUDE_DIRS) + +# tidy compiler flags +CFLAGS := $(filter-out $(DEFINES), $(CFLAGS)) +CXXFLAGS := $(filter-out $(DEFINES), $(CXXFLAGS)) + +# LLVM is needed for the state tracker +MESA_CFLAGS := $(LLVM_CFLAGS) +ES1_CFLAGS := $(LLVM_CFLAGS) +ES2_CFLAGS := $(LLVM_CFLAGS) define mesa-cc-c @mkdir -p $(dir $@) - $(CC) -c -o $@ $< $($(1)_CPPFLAGS) $($(1)_INCLUDES) $(CFLAGS) + $(CC) -c -o $@ $< $($(1)_CPPFLAGS) $($(1)_CFLAGS) $(CFLAGS) +endef + +define mesa-cxx-c + @mkdir -p $(dir $@) + $(CXX) -c -o $@ $< $($(1)_CPPFLAGS) $($(1)_CFLAGS) $(CXXFLAGS) endef $(MESA_OBJ_DIR)/%.o: %.c $(call mesa-cc-c,MESA) +$(MESA_OBJ_DIR)/%.o: %.cpp + $(call mesa-cxx-c,MESA) + $(MESA_OBJ_DIR)/%.o: %.S $(call mesa-cc-c,MESA) $(ES1_OBJ_DIR)/%.o: %.c $(call mesa-cc-c,ES1) +$(ES1_OBJ_DIR)/%.o: %.cpp + $(call mesa-cxx-c,ES1) + $(ES1_OBJ_DIR)/%.o: %.S $(call mesa-cc-c,ES1) $(ES2_OBJ_DIR)/%.o: %.c $(call mesa-cc-c,ES2) +$(ES2_OBJ_DIR)/%.o: %.cpp + $(call mesa-cxx-c,ES2) + $(ES2_OBJ_DIR)/%.o: %.S $(call mesa-cc-c,ES2) # Default: build dependencies, then asm_subdirs, GLSL built-in lib, # then convenience libs (.a) and finally the device drivers: -default: $(DEPENDS) asm_subdirs glsl_builtin \ +default: $(DEPENDS) asm_subdirs \ $(MESA_LIBS) $(ES1_LIBS) $(ES2_LIBS) driver_subdirs main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py @@ -113,34 +137,26 @@ asm_subdirs: fi -###################################################################### -# GLSL built-in library -glsl_builtin: - (cd slang/library && $(MAKE)) || exit 1 ; - - ###################################################################### # Dependency generation depend: $(ALL_SOURCES) @ echo "running $(MKDEP)" @ touch depend - @$(MKDEP) $(MKDEP_OPTIONS) -p$(MESA_OBJ_DIR)/ $(DEFINES) \ - $(INCLUDE_DIRS) $(ALL_SOURCES) > /dev/null 2>/dev/null + @$(MKDEP) $(MKDEP_OPTIONS) -p$(MESA_OBJ_DIR)/ $(MESA_CPPFLAGS) \ + $(ALL_SOURCES) > /dev/null 2>/dev/null depend.es1: $(ALL_SOURCES) @echo "running $(MKDEP) for ES1" @touch $@ - @$(MKDEP) $(MKDEP_OPTIONS) -f$@ -p$(ES1_OBJ_DIR)/ $(DEFINES) \ - $(ES1_CPPFLAGS) $(ES1_INCLUDES) $(ALL_SOURCES) \ - > /dev/null 2>/dev/null + @$(MKDEP) $(MKDEP_OPTIONS) -f$@ -p$(ES1_OBJ_DIR)/ $(ES1_CPPFLAGS) \ + $(ALL_SOURCES) > /dev/null 2>/dev/null depend.es2: $(ALL_SOURCES) @echo "running $(MKDEP) for ES2" @touch $@ - @$(MKDEP) $(MKDEP_OPTIONS) -f$@ -p$(ES2_OBJ_DIR)/ $(DEFINES) \ - $(ES2_CPPFLAGS) $(ES2_INCLUDES) $(ALL_SOURCES) \ - > /dev/null 2>/dev/null + @$(MKDEP) $(MKDEP_OPTIONS) -f$@ -p$(ES2_OBJ_DIR)/ $(ES2_CPPFLAGS) \ + $(ALL_SOURCES) > /dev/null 2>/dev/null ###################################################################### # Installation rules @@ -234,7 +250,6 @@ clean: clean-es1 clean-es2 -rm -f depend depend.bak libmesa.a libmesagallium.a -rm -f drivers/*/*.o -rm -f *.pc - -rm -f slang/library/*_gc.h -@cd drivers/dri && $(MAKE) clean -@cd drivers/x11 && $(MAKE) clean -@cd drivers/osmesa && $(MAKE) clean