From ea90ff81f0d09ac6d2ed4a7271f737ac0b673119 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 31 Mar 2009 10:06:15 +0000 Subject: [PATCH] 2009-03-31 12:03 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + config/wce + config/wce/dir.cf + config/wce/global.cf + config/wce/install.cf + config/wce/msvcarm.cf + config/wce/mingwarm.cf + config/wce/poccarm.cf + Added new arch for WinCE: wce These will now live in parallel with old win/*ce targets until they are fully functional. We can also back up from here in case this new method turns out to be a dead end for any reason. The upgrade path is: win/msvcce -> wce/msvcarm win/mingwce -> wce/mingwarm win/poccce -> wce/poccarm The idea is that this way we may continue adding support for non-ARM WinCE platforms, if needed. It also makes it easier to do things globally for wce platform only. --- harbour/ChangeLog | 20 +++++ harbour/config/wce/dir.cf | 30 +++++++ harbour/config/wce/global.cf | 107 +++++++++++++++++++++++ harbour/config/wce/install.cf | 53 ++++++++++++ harbour/config/wce/mingwarm.cf | 153 +++++++++++++++++++++++++++++++++ harbour/config/wce/msvcarm.cf | 88 +++++++++++++++++++ harbour/config/wce/poccarm.cf | 79 +++++++++++++++++ 7 files changed, 530 insertions(+) create mode 100644 harbour/config/wce/dir.cf create mode 100644 harbour/config/wce/global.cf create mode 100644 harbour/config/wce/install.cf create mode 100644 harbour/config/wce/mingwarm.cf create mode 100644 harbour/config/wce/msvcarm.cf create mode 100644 harbour/config/wce/poccarm.cf diff --git a/harbour/ChangeLog b/harbour/ChangeLog index af428dacb3..410cb25d00 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,26 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-03-31 12:03 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + + config/wce + + config/wce/dir.cf + + config/wce/global.cf + + config/wce/install.cf + + config/wce/msvcarm.cf + + config/wce/mingwarm.cf + + config/wce/poccarm.cf + + Added new arch for WinCE: wce + These will now live in parallel with old win/*ce targets + until they are fully functional. We can also back up from + here in case this new method turns out to be a dead end + for any reason. The upgrade path is: + win/msvcce -> wce/msvcarm + win/mingwce -> wce/mingwarm + win/poccce -> wce/poccarm + The idea is that this way we may continue adding support + for non-ARM WinCE platforms, if needed. It also makes it + easier to do things globally for wce platform only. + 2009-03-31 11:46 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * INSTALL * Moved Windows CE compilers into a separate section. diff --git a/harbour/config/wce/dir.cf b/harbour/config/wce/dir.cf new file mode 100644 index 0000000000..99b55beaf1 --- /dev/null +++ b/harbour/config/wce/dir.cf @@ -0,0 +1,30 @@ +# +# $Id$ +# + +ifeq ($(PM),) # Only traverse directories if not compiling a specific module + +ifeq ($(SHLVL),) # COMMAND.COM + +ifeq ($(DIRS),) # Empty directory list +DIR_RULE =\ + @echo Done +else +DIR_LIST = $(subst /,\,$(DIRS)) +DIR_MAKE = $(subst /,\,$(MK)) +DIR_RULE =\ + $(COMSPEC) /C FOR %d IN ($(DIR_LIST)) DO $(DIR_MAKE) -C %d $@ +endif + +else # bash + +DIR_RULE =\ + @for d in $(DIRS); do \ + if [ -d $$d ]; then \ + $(MAKE) -C $$d $@; \ + fi \ + done + +endif # ! Windows + +endif # ! compiling a specific program module diff --git a/harbour/config/wce/global.cf b/harbour/config/wce/global.cf new file mode 100644 index 0000000000..980f6880e7 --- /dev/null +++ b/harbour/config/wce/global.cf @@ -0,0 +1,107 @@ +# +# $Id$ +# + +all : first + +HB_GT_LIST=\ + gtcgi \ + gtpca \ + gtstd \ + gtwin \ + gtwvt \ + gtgui \ + +# gtcrs \ +# gtsln \ + +# verify if GT drivers exist +HB_GT_LIBS := $(foreach gt, $(HB_GT_LIST), $(if $(wildcard $(TOP)$(ROOT)source/rtl/$(gt)),$(gt),)) + +ifeq ($(HB_DYNLIB),yes) + HB_CDYNLIB=-DHB_DYNLIB +endif + +ifeq ($(SHLVL),) # COMMAND.COM + +# There is a conflict with the use of '\' and '/' characters +# The MAKE requires '/' in filenames (ARCH_DIR) however some compilers +# and some DOS commands require '\' (ARCH_DOS) +ARCH_DIR = $(subst \,/,$(HB_ARCH)) +ARCH_DOS = $(subst /,\,$(HB_ARCH)) +LIB_DIR_DOS = $(subst /,\,$(LIB_DIR)) +LIB_PATH_DOS = $(subst /,\,$(LIB_PATH)) +LIB_ARCH_DOS = $(subst /,\,$(LIB_ARCH)) +DIRSEP = $(subst /,\,\) + +MK := $(subst \,/,$(subst \~,~,$(MAKE))) + +ifeq ($(COMSPEC),) #location of command.com + ifeq ($(OS),Windows_NT) + COMSPEC := cmd.exe + else + COMSPEC := command.com + endif +endif + +ifeq ($(findstring cmd.exe,$(COMSPEC)),cmd.exe) + CMD_EXE := yes +else + CMD_EXE := no +endif + +RM = del +RD = rmdir +MD = md +CP = $(COMSPEC) /C copy +MV = move + +ifeq ($(CMD_EXE),yes) + +RM = del /q /f +RD = rmdir /q /s + +dirbase:: + -@$(COMSPEC) /c \ + for %d in ($(HB_ARCHITECTURE) $(ARCH_DOS)) do if not exist %d\. $(MD) %d + $(if $(LIB_PATH_DOS),-@$(COMSPEC) /c \ + for %d in ($(LIB_PATH_DOS) $(LIB_DIR_DOS)) do if not exist %d\. $(MD) %d,) + +clean:: + -@$(COMSPEC) /c \ + if exist $(ARCH_DOS) $(RD) $(ARCH_DOS) + $(if $(LIB_ARCH_DOS),-@$(COMSPEC) /c if exist $(LIB_ARCH_DOS) $(RM) $(LIB_ARCH_DOS),) + +else # command.com + +dirbase:: + -@for %%d in ($(HB_ARCHITECTURE) $(ARCH_DOS)) do if not exist %%d\nul $(MD) %%d + $(if $(LIB_PATH_DOS),-@for %%d in ($(LIB_PATH_DOS) $(LIB_DIR_DOS)) do if not exist %%d\nul $(MD) %%d,) + +clean:: + -@for %%f in ($(ARCH_DOS)\*.* *.bak *.obj *.o *.tds) do $(RM) %%f + -@for %%d in ($(ARCH_DOS) $(HB_ARCHITECTURE)) do if exist %%d\nul $(RD) %%d + $(if $(LIB_ARCH_DOS),-@if exist $(LIB_ARCH_DOS) $(RM) $(LIB_ARCH_DOS),) + +endif + +else # bash + +ARCH_DIR = $(HB_ARCH) +MK = $(MAKE) + +RM = rm -f +RD = rm -f -r +CP = cp -f +MV = mv -f +MD = mkdir +MDP = mkdir -p + +dirbase:: + @[ -d $(ARCH_DIR) ] || $(MDP) $(ARCH_DIR) + @[ -z $(LIB_DIR) ] || [ -d $(LIB_DIR) ] || $(MDP) $(LIB_DIR) + +clean:: + -$(RD) $(ARCH_DIR) $(LIB_ARCH) + +endif diff --git a/harbour/config/wce/install.cf b/harbour/config/wce/install.cf new file mode 100644 index 0000000000..3abb21fdef --- /dev/null +++ b/harbour/config/wce/install.cf @@ -0,0 +1,53 @@ +# +# $Id$ +# + +ifeq ($(INSTALL_OBJS),) # Empty install list + +INSTALL_RULE = @echo Done + +else + +ifeq ($(SHLVL),) # command.com or cmd.exe + +INSTALL_LIST = $(subst /,\,$(INSTALL_OBJS)) + +ifeq ($(CMD_EXE),yes) +# cmd.exe no command line size limit +INSTALL_RULE = \ + -$(COMSPEC) /c for %f in ($(INSTALL_LIST)) do copy %f $(subst /,\,$(INSTALL_DIR)) +else +# We have to use script to overcome the DOS limit of max 128 characters +# NOTE: The empty line directly before 'endef' HAVE TO exist! +# It causes that every commands will be separated by LF +define inst_file +$(CP) $(file) $(subst /,\,$(INSTALL_DIR)) + +endef +INSTALL_RULE = \ + $(foreach file, $(INSTALL_LIST), $(inst_file)) +endif + +else # bash + +INSTALL_RULE =\ + @if [ ! -d $(INSTALL_DIR) ]; \ + then \ + echo "! Can't install, path not found: $(INSTALL_DIR)" 1>&2; \ + else \ + for i in $(INSTALL_OBJS); \ + do \ + if [ -r $$i ]; \ + then \ + echo "! Installing $$i on $(INSTALL_DIR)"; \ + $(CP) $$i $(INSTALL_DIR); \ + true; \ + else \ + echo "! Can't install $$i, not found" 1>&2; \ + fi \ + done \ + fi + +endif + +endif # Empty install list diff --git a/harbour/config/wce/mingwarm.cf b/harbour/config/wce/mingwarm.cf new file mode 100644 index 0000000000..10e446f5f8 --- /dev/null +++ b/harbour/config/wce/mingwarm.cf @@ -0,0 +1,153 @@ +# +# $Id$ +# + +include $(TOP)$(ROOT)config/$(HB_ARCHITECTURE)/global.cf + +OBJ_EXT = .o +EXE_EXT = .exe +LIB_PREF = lib +LIB_EXT = .a + +# Favor size for CE builds. +HB_GCMODE=0 + +CC = $(HB_CCPREFIX)gcc +CC_IN = -c +CC_OUT = -o +CPPFLAGS = -I. -I$(HB_INC_COMPILE) +CFLAGS = + +ifneq ($(HB_BUILD_WARN),no) +CFLAGS += -Wall -W +endif + +ifneq ($(HB_BUILD_OPTIM),no) +# Use -O2 instead of -O3 here. +CFLAGS += -O2 +CFLAGS += -fomit-frame-pointer +endif + +ifeq ($(HB_BUILD_DEBUG),yes) +CFLAGS += -g +endif + +LD = $(HB_CCPREFIX)gcc +LD_OUT = -o +LINKPATHS = +LDLIBS = + +# Add all libraries specified in CONTRIBS and LIBS. +ifeq ($(HB_LIB_COMPILE),) +LINKPATHS += -L$(LIB_DIR) +else +LINKPATHS += -L$(HB_LIB_COMPILE) +endif + +LDLIBS += $(foreach lib, $(CONTRIBS), -l$(subst lib,,$(lib))) +LDLIBS += $(foreach lib, $(LIBS), -l$(lib)) + +# If LIBS specifies the rdd library, add all DB drivers. +ifeq ($(findstring rdd,$(LIBS)),rdd) +LDLIBS += $(foreach drv, $(HB_DB_DRIVERS), -l$(drv)) +endif + +# Add the specified GT driver library +ifeq ($(findstring rtl,$(LIBS)),rtl) +LDLIBS += $(foreach gt, $(HB_GT_LIBS), -l$(gt)) +endif + +# HB_SCREEN_LIB: empty, or one of ncurses, slang +# HB_SCREEN_LIB=ncurses +# HB_SCREEN_LIB=slang + +ifneq ($(HB_SCREEN_LIB),) +LDLIBS += -l$(HB_SCREEN_LIB) +endif + +# Add the optional user path(s) +ifneq ($(LNK_USR_PATH),) +LINKPATHS += $(foreach path, $(LNK_USR_PATH), -L$(path)) +endif + +# Add the optional user libarary (or libraries) +ifneq ($(LNK_USR_LIB),) +LDLIBS += $(foreach lib, $(LNK_USR_LIB), -l$(lib)) +endif + +SYSLIBS = -lwininet -lws2 +# for contribs +SYSLIBS += -lcommdlg -lcommctrl -luuid -lole32 + +# NOTE: The empty line directly before 'endef' HAVE TO exist! +# It causes that every echo command will be separated by LF +define lib_object +echo. ADDMOD $(file) >> __lib__.tmp + +endef + +# We have to use script to overcome the DOS limit of max 128 characters +# in commmand line +define create_library +echo. CREATE $(LIB_DIR)/$@ > __lib__.tmp +$(foreach file, $(^F), $(lib_object)) +echo. SAVE >> __lib__.tmp +echo. END >> __lib__.tmp +$(AR) $(ARFLAGS) -M < __lib__.tmp +endef + +# NOTE: The empty line below HAVE TO exist! +define link_file +echo. $(file) >> __link__.tmp + +endef + +define search_dir +echo. SEARCH_DIR($(file)) >> __link__.tmp + +endef + +ifneq ($(strip $(LDLIBS)),) +define libs_list +echo. GROUP( >> __link__.tmp +$(foreach file, $(LDLIBS), $(link_file)) +echo. ) >> __link__.tmp +endef +else +libs_list= +endif + +define link_exe_file +echo. INPUT( >> __link__.tmp +$(foreach file, $(^F), $(link_file)) +echo. ) >> __link__.tmp +$(libs_list) +$(foreach file, $(subst -L,,$(LINKPATHS)), $(search_dir)) +echo. GROUP( >> __link__.tmp +$(foreach file, $(SYSLIBS), $(link_file)) +echo. ) >> __link__.tmp +-$(LD) $(LDFLAGS) $(HB_USER_LDFLAGS) $(LD_OUT)$@ __link__.tmp +endef + +LDFLAGS = + +AR = $(HB_CCPREFIX)ar +ARFLAGS = $(HB_USER_AFLAGS) + +RANLIB = $(HB_CCPREFIX)ranlib + +ifeq ($(SHLVL),) # COMMAND.COM - length of command line is limited +ifneq ($(OS),Windows_NT) +AR_RULE = $(create_library) +LD_RULE = $(link_exe_file) +endif +endif + +ifeq ($(AR_RULE),) +AR_RULE = $(AR) $(ARFLAGS) cr $(LIB_DIR)/$@ $(^F) && $(RANLIB) $(LIB_DIR)/$@ || $(RM) $(LIB_DIR)/$@ +# our libs have a lot of cross referenced now and we have to group them +# until we won't have cleaned them +LINKLIBS = $(LINKPATHS) -Wl,--start-group $(LDLIBS) -Wl,--end-group $(SYSLIBS) +endif + +include $(TOP)$(ROOT)config/rules.cf diff --git a/harbour/config/wce/msvcarm.cf b/harbour/config/wce/msvcarm.cf new file mode 100644 index 0000000000..660051fb3b --- /dev/null +++ b/harbour/config/wce/msvcarm.cf @@ -0,0 +1,88 @@ +# +# $Id$ +# + +# Work in progress. Please test. + +include $(TOP)$(ROOT)config/$(HB_ARCHITECTURE)/global.cf + +OBJ_EXT = .obj +EXE_EXT = .exe +LIB_PREF = +LIB_EXT = .lib + +# Favor size for CE builds. +HB_GCMODE=0 + +ifeq ($(HB_VISUALC_VER_PRE80),) +CC = cl.exe +else +CC = clarm.exe +endif +CC_IN = -c +CC_OUT = -Fo +CPPFLAGS = -I. -I$(HB_INC_COMPILE) +CFLAGS = -nologo -D"_WIN32_WCE=0x420" -D"UNDER_CE=0x420" -D"WIN32_PLATFORM_PSPC" -D"WINCE" -D"_WINCE" -D"_WINDOWS" -D"ARM" -D"_ARM_" -D"ARMV4" -D"POCKETPC2003_UI_MODEL" -D"_M_ARM" -D"UNICODE" -D"_UNICODE" -D_UWIN + +ifeq ($(HB_BUILD_MODE),c) +CFLAGS += -TC +endif +ifeq ($(HB_BUILD_MODE),cpp) +CFLAGS += -TP +endif + +ifneq ($(HB_BUILD_WARN),no) +CFLAGS += -W4 +endif + +ifneq ($(HB_BUILD_OPTIM),no) +ifeq ($(HB_VISUALC_VER_PRE80),) +CFLAGS += -Od -Os -Gy -GS- -EHsc- -Gm -Zi -GR- +else +CFLAGS += -Oxsb1 -EHsc -YX -GF +endif +endif + +ifeq ($(HB_BUILD_DEBUG),yes) +CFLAGS += -Zi +endif + +ifeq ($(HB_VISUALC_VER_PRE80),) +LD = cl.exe +else +LD = clarm.exe +endif +LD_OUT = -Fe + +LINKPATHS += /link +LINKPATHS += /subsystem:windowsce,4.20 /machine:arm /armpadcode /stack:65536,4096 /nodefaultlib:"oldnames.lib" +LINKPATHS += /nodefaultlib:"kernel32.lib" /align:4096 /opt:ref /opt:icf +ifeq ($(HB_VISUALC_VER_PRE80),) +LINKPATHS += /manifest:no +endif +ifeq ($(HB_LIB_COMPILE),) +LINKPATHS += /libpath:$(LIB_DIR) +else +LINKPATHS += /libpath:$(HB_LIB_COMPILE) +endif +# Add all libraries specified in CONTRIBS and LIBS. +LINKLIBS += $(foreach lib, $(CONTRIBS), $(subst lib,,$(lib))$(LIB_EXT)) +LINKLIBS += $(foreach lib, $(LIBS), $(lib)$(LIB_EXT)) + +# If LIBS specifies the rdd library, add all DB drivers. +ifeq ($(findstring rdd,$(LIBS)),rdd) +LINKLIBS += $(foreach drv, $(HB_DB_DRIVERS), $(drv)$(LIB_EXT)) +endif + +# Add the specified GT driver library +ifeq ($(findstring rtl,$(LIBS)),rtl) +LINKLIBS += $(foreach gt, $(HB_GT_LIBS), $(gt)$(LIB_EXT)) +endif + +LDFLAGS = $(LINKPATHS) + +AR = lib.exe +ARFLAGS = $(HB_USER_AFLAGS) +AR_RULE = $(AR) $(ARFLAGS) /out:$(LIB_DIR)/$@ $(^F) || $(RM) $(LIB_DIR)/$@ + +include $(TOP)$(ROOT)config/rules.cf diff --git a/harbour/config/wce/poccarm.cf b/harbour/config/wce/poccarm.cf new file mode 100644 index 0000000000..642e2c3695 --- /dev/null +++ b/harbour/config/wce/poccarm.cf @@ -0,0 +1,79 @@ +# +# $Id$ +# + +# The Harbour Project +# GNU MAKE file for Pelles ISO C Compiler for WinCE + +include $(TOP)$(ROOT)config/$(HB_ARCHITECTURE)/global.cf + +OBJ_EXT = .obj +EXE_EXT = .exe +LIB_PREF = +LIB_EXT = .lib + +# Favor size for CE builds. +HB_GCMODE=0 + +CC = pocc.exe +CC_IN = -c +CC_OUT = -Fo +CPPFLAGS = -I. + +CPPFLAGS += -Ze -Go + +ifneq ($(HB_BUILD_WARN),no) +CPPFLAGS += -W1 +endif + +ifneq ($(HB_BUILD_OPTIM),no) +CPPFLAGS += -Ot +# -Ox: can cause GPF in 4.50/5.00, so it's disabled. +endif + +# For Pocket PC and ARM processors (including XScale) +CPPFLAGS += -Tarm-coff -D_M_ARM -D_WINCE -DUNICODE -DHB_NO_WIN_CONSOLE + +ifneq ($(HB_INC_COMPILE),) +CPPFLAGS += -I$(HB_INC_COMPILE) +endif + +ifeq ($(HB_BUILD_DEBUG),yes) +CPPFLAGS += -Zi +endif + +CFLAGS = + +LD = polink.exe +LD_OUT = -OUT: + +# Add all libraries specified in CONTRIBS and LIBS. +ifeq ($(HB_LIB_COMPILE),) +LINKPATHS += -LIBPATH:$(LIB_DIR) +else +LINKPATHS += -LIBPATH:$(HB_LIB_COMPILE) +endif +LINKLIBS += $(foreach lib, $(CONTRIBS), $(subst lib,,$(lib))$(LIB_EXT)) +LINKLIBS += $(foreach lib, $(LIBS), $(lib)$(LIB_EXT)) + +# If LIBS specifies the rdd library, add all DB drivers. +ifeq ($(findstring rdd,$(LIBS)),rdd) +LINKLIBS += $(foreach drv, $(HB_DB_DRIVERS), $(drv)$(LIB_EXT)) +endif + +# Add the specified GT driver library +ifeq ($(findstring rtl,$(LIBS)),rtl) +LINKLIBS += $(foreach gt, $(HB_GT_LIBS), $(gt)$(LIB_EXT)) +endif + +LDFLAGS = $(LINKPATHS) coredll.lib corelibc.lib winsock.lib ws2.lib + +ifeq ($(HB_GT_LIB),gtgui) +LDFLAGS += /SUBSYSTEM:WINDOWS +endif + +AR = polib.exe +ARFLAGS = $(HB_USER_AFLAGS) +AR_RULE = $(AR) $(ARFLAGS) /out:$(LIB_DIR)/$@ $(^F) + +include $(TOP)$(ROOT)config/rules.cf