1
1
Fork 0
s-lang/common.mk

100 lines
5.3 KiB
Makefile

ifndef QCONFIG
QCONFIG=qconfig.mk
endif
include $(QCONFIG)
CONFIGUREFLAGS += --without-png
define TARGET_CONFIGURE
$(PRE_CONFIGURE)
@echo "$(BUILDNAME): configure start"
$(eval AC_VERSION=$(shell _pat='/[Gg]enerated.*[Aa]utoconf/s/.*\([1-9]\.[0-9][0-9]*\).*/\1/p'; \
[ "$${_guess}" ] || _guess=$$($(PROJECT_ROOT)/configure --version | sed -n -e "$${_pat}"); \
[ "$${_guess}" ] || _guess=$$(sed -n -e "1,10{; \
$${_pat}; \
}" <$(PROJECT_ROOT)/configure); echo $${_guess}))
$(call AutoconfVersion,$(AC_VERSION))
@echo "$(BUILDNAME): MACHINE=$(TARGET_COMPILER_MACHINE)"
@echo "$(BUILDNAME): VERSION=$(TARGET_COMPILER_VERSION)"
@echo "$(BUILDNAME): HOST_MACHINE=$(HOST_COMPILER_MACHINE)"
@echo "$(BUILDNAME): HOST_VERSION=$(HOST_COMPILER_VERSION)"
@echo "$(BUILDNAME): GCC_VERSION=$(firstword $(GCC_VERSION) undefined)"
@echo "$(BUILDNAME): BINUTILS_VERSION=$(firstword $(BINUTILS_VERSION) undefined)"
$(eval TARGET_ENDIAN_FLAGS=$(if $(filter mips,$(CPU)),$(if $(filter be,$(VARIANT_LIST)),-EB,$(if $(filter le,$(VARIANT_LIST)),-EL))))
$(if $(filter nto,$(OS)),\
$(eval CC="$(TARGET_COMPILER_MACHINE)-gcc$(if $(filter-out e2k,$(CPU)),$(if $(GCC_VERSION),-$(GCC_VERSION))) $(TARGET_ENDIAN_FLAGS) $(EXTRA_CC_$(OS))") \
$(eval CXX="$(TARGET_COMPILER_MACHINE)-g++$(if $(filter-out e2k,$(CPU)),$(if $(GCC_VERSION),-$(GCC_VERSION))) $(TARGET_ENDIAN_FLAGS) $(EXTRA_CXX_$(OS))") \
$(eval AS="$(TARGET_COMPILER_MACHINE)-as$(if $(filter-out e2k,$(CPU)),$(if $(BINUTILS_VERSION),-$(BINUTILS_VERSION))) $(TARGET_ENDIAN_FLAGS)") \
$(eval LD="$(TARGET_COMPILER_MACHINE)-ld$(if $(filter-out e2k,$(CPU)),$(if $(BINUTILS_VERSION),-$(BINUTILS_VERSION))) $(TARGET_ENDIAN_FLAGS)") \
,\
$(if $(filter linux64,$(OS)),\
$(eval CC="$(TARGET_COMPILER_MACHINE)-gcc$(if $(LINUXGCC_VERSION),-$(LINUXGCC_VERSION)) -march=x86-64 -mtune=generic") \
$(eval CXX="$(TARGET_COMPILER_MACHINE)-g++$(if $(LINUXGCC_VERSION),-$(LINUXGCC_VERSION)) -march=x86-64 -mtune=generic") \
,\
$(if $(filter linux,$(OS)),\
$(eval CC="$(TARGET_COMPILER_MACHINE)-gcc$(if $(LINUXGCC_VERSION),-$(LINUXGCC_VERSION)) -m32 -march=i686 -mtune=generic") \
$(eval CXX="$(TARGET_COMPILER_MACHINE)-g++$(if $(LINUXGCC_VERSION),-$(HOSTGCC_VERSION)) -m32 -march=i686 -mtune=generic") \
,\
$(if $(filter win64,$(OS)),\
$(eval CC="$(TARGET_COMPILER_MACHINE)-gcc$(if $(WINGCC_VERSION),-$(WINGCC_VERSION)) -march=x86-64 -mtune=generic") \
$(eval CXX="$(TARGET_COMPILER_MACHINE)-g++$(if $(WINGCC_VERSION),-$(WINGCC_VERSION)) -march=x86-64 -mtune=generic") \
,\
$(if $(filter win32,$(OS)),\
$(eval CC="$(TARGET_COMPILER_MACHINE)-gcc$(if $(WINGCC_VERSION),-$(WINGCC_VERSION)) -march=i686 -mtune=generic") \
$(eval CXX="$(TARGET_COMPILER_MACHINE)-g++$(if $(WINGCC_VERSION),-$(WINGCC_VERSION)) -march=i686 -mtune=generic") \
) \
) \
) \
) \
)
$(eval CFLAGS=$(if $(CFLAGS),$(CFLAGS) )$(CCFLAGS) $(FLAGS) $(CCVFLAGS) $(CCOPTS))
$(eval CPPFLAGS=$(if $(CPPFLAGS),$(CPPFLAGS) )$(filter-out $(if $(GDB_DEBUG),-g$(GDB_DEBUG)),$(CCFLAGS) $(FLAGS) $(CCVFLAGS) $(CCOPTS)))
$(eval CXXFLAGS=$(if $(CXXFLAGS),$(CXXFLAGS) )$(CCFLAGS) $(FLAGS) $(CCVFLAGS) $(CCOPTS))
$(eval LDFLAGS=$(if $(LDFLAGS),$(LDFLAGS) )$(lib_path) $(libopts) $(LDVFLAGS) $(LDOPTS))
$(if $(wildcard $(PROJECT_ROOT)/nto-config.site),$(eval CONFIG_SITE=$(PROJECT_ROOT)/nto-config.site))
$(eval CONFIGUREFLAGS += $(if $(filter-out undefined,$(flavor CONFIGURE_HOST)),$(if $(CONFIGURE_HOST),--host=$(CONFIGURE_HOST)),--host=$(TARGET_COMPILER_MACHINE)))
$(eval CONFIGUREFLAGS += $(if $(filter-out undefined,$(flavor CONFIGURE_BUILD)),$(if $(CONFIGURE_BUILD),--build=$(CONFIGURE_BUILD)),--build=$(HOST_COMPILER_MACHINE)))
$(if $(filter-out undefined,$(flavor CONFIGURE_TARGET)),$(eval CONFIGUREFLAGS += --target=$(CONFIGURE_TARGET)))
$(if $(filter Y,$(ac_params)), \
\
$(eval CONFIGUREFLAGS += CC=$(CC)) \
$(eval CONFIGUREFLAGS += CXX=$(CXX)) \
$(eval CONFIGUREFLAGS += AS=$(AS)) \
$(eval CONFIGUREFLAGS += LD=$(LD)) \
$(eval CONFIGUREFLAGS += CFLAGS="$(CFLAGS)") \
$(eval CONFIGUREFLAGS += CPPFLAGS="$(CPPFLAGS)") \
$(eval CONFIGUREFLAGS += CXXFLAGS="$(CXXFLAGS)") \
$(eval CONFIGUREFLAGS += LDFLAGS="$(LDFLAGS)") \
$(if $(CONFIG_SITE),$(eval CONFIGUREFLAGS += CONFIG_SITE=$(CONFIG_SITE))) \
$(eval CONFIGUREFLAGS += $(AC_AUTOTOOLS)),\
\
$(eval CONFIGUREVARS += CC=$(CC)) \
$(eval CONFIGUREVARS += CXX=$(CXX)) \
$(eval CONFIGUREVARS += AS=$(AS)) \
$(eval CONFIGUREVARS += LD=$(LD)) \
$(eval CONFIGUREVARS += CFLAGS="$(CFLAGS)") \
$(eval CONFIGUREVARS += CPPFLAGS="$(CPPFLAGS)") \
$(eval CONFIGUREVARS += CXXFLAGS="$(CXXFLAGS)") \
$(eval CONFIGUREVARS += LDFLAGS="$(LDFLAGS)") \
$(if $(CONFIG_SITE),$(eval CONFIGUREVARS += CONFIG_SITE=$(CONFIG_SITE))) \
$(eval CONFIGUREVARS += $(AC_AUTOTOOLS)) \
)
@echo "$(BUILDNAME): CONFIGUREFLAGS=$(CONFIGUREFLAGS)"
mkdir -p $(BUILDDIR)
cp -R $(PROJECT_ROOT)/autoconf $(PROJECT_ROOT)/demo $(PROJECT_ROOT)/doc $(PROJECT_ROOT)/examples $(PROJECT_ROOT)/mkfiles $(PROJECT_ROOT)/modules $(PROJECT_ROOT)/slsh $(PROJECT_ROOT)/src $(PROJECT_ROOT)/utf8 $(PROJECT_ROOT)/changes.txt $(PROJECT_ROOT)/configure $(PROJECT_ROOT)/slang.lis $(PROJECT_ROOT)/UPGRADE.txt $(BUILDDIR)/
cd $(BUILDDIR); $(CONFIGUREVARS) ./configure --prefix=$(INSTALL_PREFIX) $(CONFIGUREFLAGS)
$(POST_CONFIGURE)
endef
CFLAGS += -D_XOPEN_SOURCE=600
include $(MKFILES_ROOT)/autotools.mk
include $(MKFILES_ROOT)/qtargets.mk