make: Add support for mingw

This commit is contained in:
Jan Lindemann 2007-07-13 10:49:58 +00:00 committed by Jan Lindemann
commit 65ba4f3cfd
5 changed files with 47 additions and 9 deletions

View file

@ -11,12 +11,12 @@ VERSION ?= $(shell cat $(TOPDIR)/VERSION)
DIST_VERSION ?= $(shell sed -e "s/-dev//" $(TOPDIR)/VERSION)
HEX_VERSION = $(shell echo $(DIST_VERSION) | \
sed 's/-dev//; s/pre[^\.]*//; s/F[^\.]//; s/[\.-]/ /g' | xargs printf "0x%02x%02x%02x%02x")
DEVELOPMENT ?= $(shell grep -q 'dev' $(TOPDIR)/VERSION && echo true)
DEVELOPMENT ?= $(shell echo $(VERSION) | grep -q 'dev' && echo true)
USE_PROJECT_LIB ?= true
USE_YTOOLS ?= true
REENTRANT ?= true
USE_GFILTER ?= true
OS ?= $(shell sh $(MODDIR)/bin/get_os.sh)
OS ?= $(shell sh $(MODDIR)/devutil/scripts/get_os.sh)
ifneq ($(shell echo $(OS) | cut -d: -f1),suse-9)
SYSCONFIG_FILE ?= /etc/rc.config
@ -34,11 +34,14 @@ CONFIG_FILE ?= $(CONFIG_DIR)/$(PROJECT).conf
export REENTRANT
USE_CFG_XXX_MK ?= true
ifeq ($(USE_CFG_XXX_MK),true)
ifeq ($(DEVELOPMENT),true)
include $(TOPDIR)/make/cfg_dev.mk
else
include $(TOPDIR)/make/cfg_dist.mk
endif
endif
OPTS_PID_FILE ?= $(PIDDIR)/$(PROJECT).pid
@ -50,6 +53,17 @@ ifndef LIBNAME
LIBNAME := $(PROJECT)
endif
TARGET ?= Linux
ifeq ($(TARGET),mingw)
CROSS_TOOL_DIR = /opt/cross-tools
CROSS_TOOL_BIN_PREFIX = $(CROSS_TOOL_DIR)/bin/i386-mingw32-
CC = $(CROSS_TOOL_BIN_PREFIX)gcc
GPP = $(CROSS_TOOL_BIN_PREFIX)g++
LDFLAGS += -Wl,--out-implib
endif
YTOOLS_DIR = $(MODDIR)
WINVERSION = $(shell echo $(VERSION) | sed -e "s/\./_/g")
LOCAL_VERSION = $(shell echo $(VERSION))
@ -73,7 +87,7 @@ FTP_PCKG_DIR = /pub/packages
JANNET_PROJ_DIR = rsync_ssh://ftp.jannet.de:/home/ftp/dat$(FTP_PCKG_DIR)
CONFDIR = $(MODDIR)/../conf
CC = gcc
CC ?= gcc
GCC_VERSION = $(shell gcc -v 2>&1 | grep version | awk '{ print $$3;}')
GCC_MAJOR = $(shell gcc -v 2>&1 | grep version | awk '{ split($$3,a,"."); print a[1];}')
@ -226,14 +240,18 @@ else
# LPPFLAGS += -L/usr/local/gcc3.3/lib
else
ifeq ($(GCC_MAJOR),4) # -PIC is more a thing with AMD64, I think
CPPFLAGS += -fPIC
CFLAGS += -fPIC
ifeq ($(TARGET),Linux)
CPPFLAGS += -fPIC
CFLAGS += -fPIC
endif
endif
endif
endif
ifeq ($(LIBTYPE),shared)
ifneq ($(TARGET),mingw)
LDFLAGS += -rdynamic
endif
endif
# TODO: this shoud be only conditional, but breaks, because not all headers