Commit 532f98c7 authored by thomas's avatar thomas
Browse files

updated build system

git-svn-id: https://svn.grrrr.org/ext/trunk@920 4d9ac71a-51e6-0310-8455-cad1006bcd31
parent ba79fc85
......@@ -4,7 +4,7 @@
@rem %1 - platform (win/lnx/mac)
@rem %2 - system (pd/max)
@rem %3 - compiler (msvc/gcc/mingw/cygwin/bcc/icc)
@rem %4 - target (all/all-debug/all-shared/all-shared-debug/clean/install)
@rem %4 - target (build/clean/install)
@set platform=%1
@set rtsys=%2
......
......@@ -5,7 +5,7 @@ if [ "$flext" = "$0"/ ]; then flext=./ ; fi
# $1 - platform (win/lnx/mac)
# $2 - system (pd/max)
# $3 - compiler (msvc/gcc/mingw/cygwin/bcc/icc)
# $4 - target (all/all-debug/all-shared/all-shared-debug/clean/install)
# $4 - target (build/clean/install)
platform=$1
rtsys=$2
......
......@@ -20,7 +20,7 @@
##############################
# flext-specific make stuff
!include $(BUILDPATH)bmake-flext.inc
!include $(BUILDPATH)bmake.inc
# platform-specific make stuff
!include $(BUILDPATH)$(PLATFORM)\$(RTSYS)\make-$(COMPILER).inc
......
##############################################
# flext defines
##############################################
ifdef SHARED
# --- shared ---
DEFS+=-DFLEXT_SHARED
else
ifdef THREADED
# --- static multi-threaded ---
DEFS+=-DFLEXT_THREADS
else
# --- static single-threaded ---
endif
endif
ifdef FLEXTBUILD
DEFS+=-DFLEXT_EXPORTS
endif
##############################################
# name of flext library
##############################################
ifdef SHARED
ifdef DEBUG
FLEXTNAME=flext-$(RTSYS)_d
else
FLEXTNAME=flext-$(RTSYS)
endif
else
ifdef THREADED
ifdef DEBUG
FLEXTNAME=flext-$(RTSYS)_td
else
FLEXTNAME=flext-$(RTSYS)_t
endif
else
ifdef DEBUG
FLEXTNAME=flext-$(RTSYS)_d
else
FLEXTNAME=flext-$(RTSYS)
endif
endif
endif # SHARED
##############################################
# build subdirectories
##############################################
ifdef FLEXTBUILD
ifdef SHARED
ifdef DEBUG
OUTSUB=dd
else
OUTSUB=dr
endif
else # SHARED
ifdef THREADED
ifdef DEBUG
OUTSUB=td
else
OUTSUB=tr
endif
else
ifdef DEBUG
OUTSUB=sd
else
OUTSUB=sr
endif
endif
endif # SHARED
else # FLEXTBUILD
OUTSUB=.
endif # FLEXTBUILD
......@@ -21,7 +21,7 @@ endif
##############################
# flext-specific make stuff
include $(BUILDPATH)gnumake-flext.inc
include $(BUILDPATH)gnumake.inc
# platform-specific make stuff
include $(BUILDPATH)$(PLATFORM)/$(RTSYS)/make-$(COMPILER).inc
......
##############################################
# flext defines
##############################################
!ifdef SHARED
# --- shared ---
DEFS=$(DEFS) /DFLEXT_SHARED
!elseifdef THREADED
# --- static multi-threaded ---
DEFS=$(DEFS) /DFLEXT_THREADS
!else
# --- static single-threaded ---
!endif
!ifdef FLEXTBUILD
DEFS=$(DEFS) /DFLEXT_EXPORTS
!endif
##############################################
# name of flext library
##############################################
!ifdef SHARED
!ifdef DEBUG
FLEXTNAME=flext-$(RTSYS)_d
!else
FLEXTNAME=flext-$(RTSYS)
!endif
!else
!ifdef THREADED
!ifdef DEBUG
FLEXTNAME=flext-$(RTSYS)_td
!else
FLEXTNAME=flext-$(RTSYS)_t
!endif
!else
!ifdef DEBUG
FLEXTNAME=flext-$(RTSYS)_d
!else
FLEXTNAME=flext-$(RTSYS)
!endif
!endif
!endif # SHARED
##############################################
# build subdirectories
##############################################
!ifdef FLEXTBUILD
!ifdef SHARED
!ifdef DEBUG
OUTSUB=dd
!else
OUTSUB=dr
!endif
!else # SHARED
!ifdef THREADED
!ifdef DEBUG
OUTSUB=td
!else
OUTSUB=tr
!endif
!else
!ifdef DEBUG
OUTSUB=sd
!else
OUTSUB=sr
!endif
!endif
!endif # SHARED
!else # FLEXTBUILD
OUTSUB=.
!endif # FLEXTBUILD
# override product name
OUTNAME=$(FLEXTNAME)
......@@ -18,10 +18,43 @@
##############################
# flext-specific make stuff
!include $(BUILDPATH)nmake-flext.inc
!ifndef TARGETMODE
!ifdef DEBUG
TARGETMODE=debug
!else
TARGETMODE=release
!endif
!endif
!ifndef TARGETTYPE
!ifdef SHARED
TARGETTYPE=shared
!else
!ifdef THREADED
TARGETTYPE=multi
!else
TARGETTYPE=single
!endif
!endif
!endif
##############################
# flext-specific definitions
!include $(BUILDPATH)nmake.inc
!include $(BUILDPATH)nmake-$(BUILDCLASS).inc
##############################
# platform-specific make stuff
!include $(BUILDPATH)$(PLATFORM)\$(RTSYS)\make-$(COMPILER).inc
!include $(BUILDPATH)$(PLATFORM)\$(RTSYS)\make-$(COMPILER)-$(BUILDCLASS).inc
##############################
# general make stuff
!include $(BUILDPATH)$(PLATFORM)\make-$(COMPILER).inc
!include $(BUILDPATH)$(PLATFORM)\make-$(COMPILER)-$(BUILDCLASS).inc
......@@ -6,20 +6,13 @@
# --- shared ---
DEFS=$(DEFS) /DFLEXT_SHARED
!else
!ifdef THREADED
!elseifdef THREADED
# --- static multi-threaded ---
DEFS=$(DEFS) /DFLEXT_THREADS
!else
# --- static single-threaded ---
!endif
!endif
!ifdef FLEXTBUILD
DEFS=$(DEFS) /DFLEXT_EXPORTS
!endif
##############################################
......@@ -44,47 +37,17 @@ FLEXTNAME=flext-$(RTSYS)_t
!endif
!else
!ifdef DEBUG
FLEXTNAME=flext-$(RTSYS)_d
FLEXTNAME=flext-$(RTSYS)_sd
!else
FLEXTNAME=flext-$(RTSYS)
FLEXTNAME=flext-$(RTSYS)_s
!endif
!endif
!endif # SHARED
##############################################
# build subdirectories
# product name and folder
##############################################
!ifdef FLEXTBUILD
!ifdef SHARED
!ifdef DEBUG
OUTSUB=dd
!else
OUTSUB=dr
!endif
!else # SHARED
!ifdef THREADED
!ifdef DEBUG
OUTSUB=td
!else
OUTSUB=tr
!endif
!else
!ifdef DEBUG
OUTSUB=sd
!else
OUTSUB=sr
!endif
!endif
!endif # SHARED
!else # FLEXTBUILD
OUTSUB=.
!endif # FLEXTBUILD
OUTNAME=$(NAME)
OUTSUB=$(TARGETMODE)-$(TARGETTYPE)
......@@ -5,20 +5,48 @@
# COMPILER - msvc/gcc/mingw/cygwin
# BUILDPATH including trailing \
###############################################
# package info
USRINFO=package.txt
!include $(USRINFO)
###############################################
# check variables
!ifndef BUILDCLASS
!error BUILDCLASS must be specified in $(USRINFO)
!endif
!ifndef BUILDMODE
!error BUILDMODE must be specified in $(USRINFO)
!endif
!ifndef BUILDTYPE
!error BUILDTYPE must be specified in $(USRINFO)
!endif
##############################
!ifndef TARGETMODE
TARGETMODE=$(BUILDMODE)
!endif
!ifndef TARGETTYPE
TARGETTYPE=$(BUILDTYPE)
!endif
###############################################
SYSCONFIG=$(BUILDPATH)config-$(PLATFORM)-$(RTSYS)-$(COMPILER).txt
SYSDEFAULT=$(BUILDPATH)$(PLATFORM)\$(RTSYS)\config-$(COMPILER).def
OPTIONS=-f $(BUILDPATH)nmake-sub.mak \
PLATFORM=$(PLATFORM) RTSYS=$(RTSYS) COMPILER=$(COMPILER) \
BUILDPATH=$(BUILDPATH) USRINFO=$(USRINFO)
###############################################
!ifdef BUILDDIR
USRCONFIG=config.txt
......@@ -29,86 +57,14 @@ USRMAKE=$(BUILDDIR)\makefile-$(PLATFORM)-$(COMPILER).inc
OPTIONS=$(OPTIONS) USRCONFIG=$(USRCONFIG) USRMAKE=$(USRMAKE)
!endif
###############################################
# include file describing default target dependencies
!ifdef FLEXTBUILD
all: flext
!else
all: build-sr
shared: build-tr
!endif
flext: flext-release flext-debug
flext-release: build-dr build-tr build-sr
flext-debug: build-dd build-td build-sd
install: install-dr install-tr install-sr install-dd install-td install-sd
clean: clean-dr clean-tr clean-sr clean-dd clean-td clean-sd
build-sr: config
$(MAKE) $(OPTIONS) _all_
build-sd: config
$(MAKE) $(OPTIONS) DEBUG=1 _all_
build-tr: config
$(MAKE) $(OPTIONS) THREADED=1 _all_
build-td: config
$(MAKE) $(OPTIONS) THREADED=1 DEBUG=1 _all_
build-dr: config
$(MAKE) $(OPTIONS) SHARED=1 _all_
build-dd: config
$(MAKE) $(OPTIONS) SHARED=1 DEBUG=1 _all_
install-sr:
$(MAKE) $(OPTIONS) _install_
install-sd:
$(MAKE) $(OPTIONS) DEBUG=1 _install_
install-tr:
$(MAKE) $(OPTIONS) THREADED=1 _install_
install-td:
$(MAKE) $(OPTIONS) THREADED=1 DEBUG=1 _install_
install-dr:
$(MAKE) $(OPTIONS) SHARED=1 _install_
install-dd:
$(MAKE) $(OPTIONS) SHARED=1 DEBUG=1 _install_
clean-sr:
$(MAKE) $(OPTIONS) _clean_
clean-sd:
$(MAKE) $(OPTIONS) DEBUG=1 _clean_
clean-tr:
$(MAKE) $(OPTIONS) THREADED=1 _clean_
clean-td:
$(MAKE) $(OPTIONS) THREADED=1 DEBUG=1 _clean_
clean-dr:
$(MAKE) $(OPTIONS) SHARED=1 _clean_
clean-dd:
$(MAKE) $(OPTIONS) SHARED=1 DEBUG=1 _clean_
!include $(BUILDPATH)targets.inc
config: $(USRMAKE) $(SYSCONFIG) $(USRCONFIG)
!include $(BUILDPATH)targets-$(BUILDCLASS).inc
###############################################
.precious: $(SYSCONFIG) $(USRCONFIG)
......
build-default-default: build-all-all
install-default-default: install-all-all
clean-default-default: clean-all-all
###################################################
build-all-all: build-release-all build-debug-all
build-release-all: build-release-single build-release-multi build-release-shared
build-debug-all: build-debug-single build-debug-multi build-debug-shared
###################################################
install-all-all: install-release-all install-debug-all
install-release-all: install-release-single install-release-multi install-release-shared
install-debug-all: install-debug-single install-debug-multi install-debug-shared
###################################################
clean-all-all: clean-release-all clean-debug-all
clean-release-all: clean-release-single clean-release-multi clean-release-shared
clean-debug-all: clean-debug-single clean-debug-multi clean-debug-shared
all: build
build: build-default-default
clean: clean-default-default
install: install-default-default
###########################################################
build-default-default: build-$(TARGETMODE)-$(TARGETTYPE)
install-default-default: install-$(TARGETMODE)-$(TARGETTYPE)
clean-default-default: clean-$(TARGETMODE)-$(TARGETTYPE)
###########################################################
build-release-single: config
$(MAKE) $(OPTIONS) build
build-debug-single: config
$(MAKE) $(OPTIONS) DEBUG=1 build
build-release-multi: config
$(MAKE) $(OPTIONS) THREADED=1 build
build-debug-multi: config
$(MAKE) $(OPTIONS) THREADED=1 DEBUG=1 build
build-release-shared: config
$(MAKE) $(OPTIONS) SHARED=1 build
build-debug-shared: config
$(MAKE) $(OPTIONS) SHARED=1 DEBUG=1 build
###########################################################
install-release-single:
$(MAKE) $(OPTIONS) install
install-debug-single:
$(MAKE) $(OPTIONS) DEBUG=1 install
install-release-multi:
$(MAKE) $(OPTIONS) THREADED=1 install
install-debug-multi:
$(MAKE) $(OPTIONS) THREADED=1 DEBUG=1 install
install-release-shared:
$(MAKE) $(OPTIONS) SHARED=1 install
install-debug-shared:
$(MAKE) $(OPTIONS) SHARED=1 DEBUG=1 install
###########################################################
clean-release-single:
$(MAKE) $(OPTIONS) clean
clean-debug-single:
$(MAKE) $(OPTIONS) DEBUG=1 clean
clean-release-multi:
$(MAKE) $(OPTIONS) THREADED=1 clean
clean-debug-multi:
$(MAKE) $(OPTIONS) THREADED=1 DEBUG=1 clean
clean-release-shared:
$(MAKE) $(OPTIONS) SHARED=1 clean
clean-debug-shared:
$(MAKE) $(OPTIONS) SHARED=1 DEBUG=1 clean
###########################################################
config: $(USRMAKE) $(SYSCONFIG) $(USRCONFIG)
# build class specific settings
INCPATH=$(INCPATH) /I$(FLEXTINC)
LIBPATH=$(LIBPATH) /LIBPATH:$(FLEXTLIB)
LIBS=$(LIBS) $(FLEXTNAME).lib
##############################################
# default target
build: $(TARGET)
$(OUTPATH):
if not exist $@ mkdir $@ > nul
$(TARGETPATH): $(OUTPATH)
if not exist $@ mkdir $@ > nul
{$(SRCDIR)}.cpp{}.obj:
cl /c /LD $(CFLAGS) $(DEFS) $(INCPATH) $** /Fo$(TARGETPATH)\$@
{$(SRCDIR)}.c{}.obj:
cl /c /LD $(CFLAGS) $(DEFS) $(INCPATH) $** /Fo$(TARGETPATH)\$@
$(TARGET):: $(TARGETPATH)
$(TARGET):: $(OBJS)
@cd $(TARGETPATH)
link /DLL $(LDFLAGS) $(LIBPATH) $(OBJS) $(LIBS) /out:$(@F)
@cd ..\..
##############################################
# remove build
clean:
-del /q $(TARGET) > nul
-cd $(TARGETPATH)