Changeset 22130 for branches


Ignore:
Timestamp:
Mar 18, 2016, 6:40:30 PM (10 years ago)
Author:
rousseau
Message:

On the verge of applying ECore Modeling -- Makefile update [apitest]

Until now XMind was used to model ApiTest.
Of course XMind is a 'mind-mapper' and not truly suitable for generating
source-code with the finesses that are possible with ECore.

To get to the next stage, where ECore will be used together with Ant to
further develop ApiTest with the purpose of getting Odin into shape so
we can run Eclipse on top of it, the Makefile had to get an overhaul.

We want to build all kinds of object-modules and target-executables
using a variety of toolchains running on several platforms or
subsystems.

The build-system is now using 'canned recipes' and some other GNU Make
capabilities to abstract the toolchains and platforms to enable the
connection between the ECore based source-code generator, Ant Build
and Gnu Make.

Platforms:
o OS/2
o Linux
o Windows

(Sub) Systems:
o OS/2 Presentation Manager
o OS/2 Odin32
o Linux Wine
o Windows Win32

ToolChains:
o Open Watcom (OS/2, Linux, Windows)
o GNU (OS/2, Linux, Windows)
o Visual Age v3.x (OS/2, Windows)
o Visual Age v4.x (OS/2, Windows)
o MSVC (low priority - depends on getting stdout to work on Odin)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/swt/testapp/apitest/GNUmakefile

    r22119 r22130  
     1# Use the new build-method if __NEW_BUILD_METHOD__ is defined
     2ifneq ($(origin __NEW_BUILD_METHOD__),undefined)
     3
     4###############################################################################
     5# GNUmakefile :: Build the ApiTest Program as multiple variants               #
     6# --------------------------------------------------------------------------- #
     7#                                                                             #
     8# The purpose of the ApiTest Program is to get Odin in a better shape.        #
     9# Currently the main focus is on the Standard Widget Toolkit for OS/2, which  #
     10# is a separate but closely related project in development. For more info see #
     11# the 'doc' directory.                                                        #
     12#                                                                             #
     13# Note:                                                                       #
     14# This is the new build-method.                                               #
     15# It is based on the toolchain-wrappers and pattern-rules.                    #
     16# The old method will be removed when the new method fully functional.        #
     17#                                                                             #
     18###############################################################################
     19
     20#
     21# This new method uses toolchain-wrapping together with pattern-rules.
     22# It has been developed to ease the connection between the upcoming generation
     23# of source-code based on ECore Models.
     24#
     25
     26# Get the name of this Makefile so in can be recursively invoked if needed.
     27# This should always be the first statement, so any include statements should
     28# go *below* this one.
     29SELF:=$(lastword $(MAKEFILE_LIST))
     30
     31# This is the true default target invoked when no targets are specified.
     32.DEFAULT_GOAL:=default
     33
     34# Prevent Make from deleting intermediate targets
     35.SECONDARY:
     36
     37# Disable standard suffix handlers so unhandled targets end-up at '.DEFAULT:'
     38.SUFFIXES:
     39
     40# Enable this to use (target-specific) vars as a dependency in the same target
     41#.SECONDEXPANSION:
     42
     43# Unhandles targets end-up here
     44.DEFAULT:
     45        @echo !!!!! Unhandled Target: [$@ -- {$^}]
     46
     47# This is the default target when no targets are specified
     48#~ default: ApiTestPm.watcom
     49default: ApiTestOdin.watcom
     50#~ default: ApiTestWin.watcom
     51#~ default: ApiTestWin.mingw32msvc
     52#~ default: ApiTestWin.mingw32
     53#~ default: ApiTestWin.mingw64
     54#~ default: test
     55
     56# The header, resources, source and output dirs relative to this Makefile
     57inc=h
     58rsrc=rsrc
     59src=src
     60out=out
     61
     62# Include the toolchain wrappers and target building rules
     63include toolchains.gmi
     64include patternrules.gmi
     65
     66# Create the output directory
     67$(shell $(md) $(out))
     68$(info created output-directory: '$(out)')
     69
     70# --------------------------------------------------------------------------- #
     71# ApiTestPm.gcc.os2 :: OS/2 Presentation Manager variant                      #
     72# --------------------------------------------------------------------------- #
     73.PHONY: ApiTestPm.gcc.os2
     74ApiTestPm.gcc.os2::
     75        $(nl)
     76        @echo [$@]
     77        @echo ---------------------------------------------------------------------
     78        @echo Building $(basename $@) using GCC for OS/2 :: OS/2 LX
     79        @echo ---------------------------------------------------------------------
     80ApiTestPm.gcc.os2:: toolchain=toolchain.gcc.os2
     81#ApiTestPm.gcc.os2:: cc++:=compiler-override-command
     82ApiTestPm.gcc.os2:: $(out)/ApiTestPm.exe
     83
     84# --------------------------------------------------------------------------- #
     85# ApiTestOdin.gcc.os2 :: Odin based variant                                   #
     86# --------------------------------------------------------------------------- #
     87.PHONY: ApiTestOdin.gcc.os2
     88ApiTestOdin.gcc.os2::
     89        $(nl)
     90        @echo [$@]
     91        @echo ---------------------------------------------------------------------
     92        @echo Building $(basename $@) using GCC for OS/2 :: OS/2 LX
     93        @echo ---------------------------------------------------------------------
     94ApiTestOdin.gcc.os2:: toolchain=toolchain.gcc.os2
     95#ApiTestOdin.gcc.os2:: cc++:=compiler-override-command
     96ApiTestOdin.gcc.os2:: $(out)/ApiTestOdin.exe
     97
     98# --------------------------------------------------------------------------- #
     99# ApiTestPm.watcom :: OS/2 Presentation Manager variant                       #
     100# --------------------------------------------------------------------------- #
     101.PHONY: ApiTestPm.watcom
     102ApiTestPm.watcom::
     103        $(nl)
     104        @echo [$@]
     105        @echo ---------------------------------------------------------------------
     106        @echo Building $(basename $@) using OpenWatcom :: OS/2 LX
     107        @echo ---------------------------------------------------------------------
     108ApiTestPm.watcom:: toolchain=toolchain.openwatcom
     109ApiTestPm.watcom:: cc.defines+=-D$*
     110ApiTestPm.watcom:: $(out)/ApiTestPm.exe
     111
     112# --------------------------------------------------------------------------- #
     113# ApiTestOdin.watcom :: Odin Based variant                                    #
     114# --------------------------------------------------------------------------- #
     115.PHONY: ApiTestOdin.watcom
     116ApiTestOdin.watcom::
     117        $(nl)
     118        @echo [$@]
     119        @echo ---------------------------------------------------------------------
     120        @echo Building $(basename $@) using OpenWatcom :: OS/2 LX
     121        @echo ---------------------------------------------------------------------
     122ApiTestOdin.watcom:: toolchain=toolchain.openwatcom
     123ApiTestOdin.watcom:: $(out)/ApiTestOdin.ors $(out)/ApiTestOdin.exe
     124
     125# --------------------------------------------------------------------------- #
     126# ApiTestOdin.watcom :: Native Win32 variant                                  #
     127# --------------------------------------------------------------------------- #
     128.PHONY: ApiTestWin.watcom
     129ApiTestWin.watcom::
     130        $(nl)
     131        @echo [$@]
     132        @echo ---------------------------------------------------------------------
     133        @echo Building $(basename $@) using OpenWatcom :: Win32 PE32
     134        @echo ---------------------------------------------------------------------
     135ApiTestWin.watcom:: toolchain=toolchain.openwatcom
     136ApiTestWin.watcom:: $(out)/ApiTestWin.exe
     137
     138# --------------------------------------------------------------------------- #
     139# ApiTestWin.mingw32msvc :: Native Win32 variant                              #
     140# --------------------------------------------------------------------------- #
     141.PHONY: ApiTestWin.mingw32msvc
     142ApiTestWin.mingw32msvc::
     143        $(nl)
     144        @echo [$@]
     145        @echo ---------------------------------------------------------------------
     146        @echo Building $(basename $@) using MinGW32msvc :: Win32 PE32
     147        @echo ---------------------------------------------------------------------
     148ApiTestWin.mingw32msvc:: toolchain=toolchain.mingw32msvc
     149ApiTestWin.mingw32msvc:: cc.flags.pre+=
     150ApiTestWin.mingw32msvc:: $(out)/ApiTestWin.exe
     151
     152# --------------------------------------------------------------------------- #
     153# ApiTestWin.mingw32 :: Native Win32 variant                                  #
     154# --------------------------------------------------------------------------- #
     155.PHONY: ApiTestWin.mingw32
     156ApiTestWin.mingw32::
     157        $(nl)
     158        @echo [$@]
     159        @echo ---------------------------------------------------------------------
     160        @echo Building $(basename $@) using MinGW32 :: Win32 PE32
     161        @echo ---------------------------------------------------------------------
     162ApiTestWin.mingw32:: toolchain=toolchain.mingw32
     163ApiTestWin.mingw32:: cc.flags.pre+=-xc
     164ApiTestWin.mingw32:: $(out)/ApiTestWin.exe
     165
     166# --------------------------------------------------------------------------- #
     167# ApiTestWin.mingw64 :: Native Win64 variant                                  #
     168# --------------------------------------------------------------------------- #
     169.PHONY: ApiTestWin.mingw64
     170ApiTestWin.mingw64::
     171        $(nl)
     172        @echo [$@]
     173        @echo ---------------------------------------------------------------------
     174        @echo Building $(basename $@) using MinGW64 :: Win64 PE64
     175        @echo ---------------------------------------------------------------------
     176ApiTestWin.mingw64:: toolchain=toolchain.mingw64
     177ApiTestWin.mingw64:: cc.flags.pre+=-xc
     178ApiTestWin.mingw64:: lnk.flags.pre=-mwindows
     179ApiTestWin.mingw64:: $(out)/ApiTestWin.exe
     180
     181# OS/2 Pm variant
     182$(out)/ApiTestPm.obj: bits=32
     183#$(out)/ApiTestPm.obj: export INCLUDE=$(WATCOM)$/$(watcom.hdir)$;$(WATCOM)$/h$/os2
     184
     185
     186$(out)/ApiTestPm.exe: platform=os2v2
     187$(out)/ApiTestPm.exe: gui=pm32
     188$(out)/ApiTestPm.exe: module.rc=$(src)/ApiTestPm.rc
     189$(out)/ApiTestPm.exe: module.def=$(src)/ApiTestPm.def
     190$(out)/ApiTestPm.exe: cc.flags.defines=-DNULL=0
     191$(out)/ApiTestPm.exe: $(out)/ApiTestPm.obj
     192
     193# OS/2 Odin variant
     194$(out)/ApiTestOdin.obj: bits=32
     195#$(out)/ApiTestOdin.obj: export INCLUDE=$(WATCOM)$/$(watcom.hdir)$;$(WATCOM)$/h$/nt
     196
     197$(out)/ApiTestOdin.exe: platform=os2v2
     198$(out)/ApiTestOdin.exe: gui=odin32
     199$(out)/ApiTestOdin.exe: module.rc=$(src)/ApiTestOdin.rc
     200$(out)/ApiTestOdin.exe: module.def=$(src)/ApiTestOdin.def
     201$(out)/ApiTestOdin.exe: cc.flags.defines=-DNULL=0
     202$(out)/ApiTestOdin.exe: $(out)/ApiTestOdin.obj
     203
     204# Windows variant
     205$(out)/ApiTestWin.obj: bits=32
     206
     207$(out)/ApiTestWin.exe: platform=win32
     208$(out)/ApiTestWin.exe: gui=win32
     209$(out)/ApiTestWin.exe: module.rc=$(src)/ApiTestWin.rc
     210$(out)/ApiTestWin.exe: module.def=$(src)/ApiTestWin.def
     211$(out)/ApiTestWin.exe: cc.flags.defines=-DNULL=0
     212$(out)/ApiTestWin.exe: $(out)/ApiTestWin.obj
     213
     214clean:
     215        $(nl)
     216        @echo [$@]
     217        rm -rf -v $(out)
     218#       rm -f -v *.objdump *.o *.obj *.coff *.omf *.ors *.res *.elf *.exe
     219
     220
     221else
     222
     223
    1224#! GENINFO :: platform:OS/2, version:20.45, target:ApiTest.generate
    2225###############################################################################
     
    42265#                                                                             #
    43266###############################################################################
     267
     268ifdef __OLD_METHOD__
     269$(error OLD)
     270endif
    44271
    45272#
     
    60287SELF:=$(lastword $(MAKEFILE_LIST))
    61288
     289# Prevent Make from deleting intermediate targets
     290.SECONDARY:
     291
    62292# This is the true default target invoked when no targets are specified.
    63293# Because only one target can be specified, we redirect to a target called
     
    67297.DEFAULT_GOAL:=default
    68298
    69 # Use 'wl.exe' for linking
    70 export EMXOMFLD_TYPE=wlink
    71 export EMXOMFLD_LINKER=wl.exe
    72 
    73 # The header, source and output directories relative to this Makefile
     299# The header, resources, source and output dirs relative to this Makefile
    74300inc=h
     301rcsrc=rcsrc
    75302src=src
    76303out=out
     304
     305# Include the toolchain wrappers and target building rules
     306include toolchains.gmi
     307include patternrules.gmi
     308
     309# Create the output directory
     310$(shell $(md) $(out))
     311$(info created output-directory: '$(out)')
    77312
    78313# Accumulate Open Watcom Include Directories and compose a ';' separated
     
    119354# This macro is invoked by defined but not yet implemented targets
    120355define target.not.implemented
    121 @echo !!! Target "$@" is not implemented yet... !!!
    122 endef
    123 
    124 # Display an empty line
    125 define nl
    126 echo.
     356@echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     357@echo !!! Unhandled Target "$@" invoked
     358@echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    127359endef
    128360
     
    332564# ! At least the '/' bug with regard to the source specification seems to be
    333565# ! fixed as of 'owcc' "Version 2.0 beta Apr 27 2014 22:48:31 (32-bit)".
     566# ! Update: Using owcc to link also experiences '/'-bug for opening .obj-files.
    334567
    335568
     
    337570# Build the Pm32 target executable (LX)
    338571# -----------------------------------------------------------------------------
    339 $(out)/ApiTestPm.exe: $(subst /,\,$(src)/ApiTestPm.cpp) $(out)/ApiTestPm.res $(module.def)
     572$(out)/ApiTestPm.exe: $(src)$/ApiTestPm.cpp $(out)/ApiTestPm.res $(module.def)
    340573        @echo [$@]
    341574        $(cc) $(cc.flags.sys) $(cc.flags.pre) $(cc.flags.incdirs) $(cc.flags.libdirs) $(cc.flags.libs) $(cc.flags.post) $(cc.defines) $< -o $@
     
    348581$(out)/ApiTestPm.res: $(src)/ApiTestPm.rc
    349582        @echo [$@]
    350         @if not exist $(out) mkdir $(out)
    351583        wrc -q -r -bt=os2 -zm -fo=$@ $<
    352584
     
    355587# Build the Odin32 target executable (LX)
    356588# -----------------------------------------------------------------------------
    357 $(out)/ApiTestOdin.exe: $(subst /,\,$(src)/ApiTestOdin.cpp) $(out)/ApiTestOdin.ors $(module.def)
     589$(out)/ApiTestOdin.exe: $(src)$/ApiTestOdin.cpp $(out)/ApiTestOdin.ors $(module.def)
    358590        @echo [$@]
    359591        $(cc) $(cc.flags.sys) $(cc.flags.pre) $(cc.flags.incdirs) $(cc.flags.libdirs) $(cc.flags.libs) $(cc.flags.post) $(cc.defines) $< -o $@
     
    375607$(out)/ApiTestOdin.ors: $(src)/ApiTestOdin.rc
    376608        @echo [$@]
    377         @if not exist $(out) mkdir $(out)
    378609        winerc -D__WIN32OS2__ -s $(cc.flags.incdirs) -I$(src) $< -o $(basename $@).s
    379610        as -Zomf $(basename $@).s -o $@
     
    397628        wrc -q -r -bt=nt -zm -fo=$@ $<
    398629
     630# ------------------------------------------------------------ [ApiTestWin.ors]
     631# Compile the Win32 resources to binary form
     632# -----------------------------------------------------------------------------
     633#$(out)/ApiTestWin.ors: $(src)/ApiTestWin.rc
     634#       @echo [$@]
     635##      @if not exist $(out) mkdir $(out)
     636###     winerc -D__WIN32OS2__ -s $(cc.flags.incdirs) -I$(src) $< -o $(basename $@).s
     637###     as -Zomf $(basename $@).s -o $@
     638#       $(rc) $(src)/$(modulename).rc -O coff -o $(@)
    399639
    400640# --------------------------------------------------------------------- [build]
     
    474714        $(out)\ApiTestWin.exe
    475715
     716# ----------------------------------------------------- [run.win32.mingw32msvc]
     717# Run the Win32 variant under Wine
     718# -----------------------------------------------------------------------------
     719run.win32.mingw32msvc: mingw32msvc.build.win32
     720        @echo [$@]
     721        wine $(out)/ApiTestWin.exe
    476722
    477723# ----------------------------------------------------------- [gen.tools.flags]
     
    495741        rm -rf -v $(out)
    496742#       rd $(out)
     743
     744endif
Note: See TracChangeset for help on using the changeset viewer.