--- /dev/null
+.PHONY: distclean distclean_all_subdirs
+ifneq ($(V),1)
+.SILENT:
+endif
+
+_cf = Cleanfile
+_d1 = ../
+_d2 = $(_d1)../
+_d3 = $(_d2)../
+_d4 = $(_d3)../
+_d5 = $(_d4)../
+_d6 = $(_d5)../
+_d7 = $(_d6)../
+_d8 = $(_d7)../
+find_sdk_src_root = $(if $(wildcard $(_cf)),,$(if $(wildcard $(_d1)$(_cf)),$(_d1),$(if $(wildcard $(_d2)$(_cf)),$(_d2),$(if $(wildcard $(_d3)$(_cf)),$(_d3),$(if $(wildcard $(_d4)$(_cf)),$(_d4),$(if $(wildcard $(_d5)$(_cf)),$(_d5),$(if $(wildcard $(_d6)$(_cf)),$(_d6),$(if $(wildcard $(_d7)$(_cf)),$(_d7),$(if $(wildcard $(_d8)$(_cf)),$(_d8),)))))))))
+
+ifneq ($(wildcard $(_CF_DIR)Cleanfile),)
+ _SDK_SRC_ROOT = $(_CF_DIR)
+endif
+ifeq ($(wildcard $(_SDK_SRC_ROOT)Cleanfile),)
+ _SDK_SRC_ROOT = $(find_sdk_src_root)
+endif
+
+$(_SDK_SRC_ROOT)Cleanfile: ;
+$(_SDK_SRC_ROOT)crossplatform.mk: ;
+
+include $(_SDK_SRC_ROOT)crossplatform.mk
+
+subdirs := $(sort $(filter-out obj,$(hs_ls_dir)))
+
+cd_make_distclean_all_subdirs = $(cd) $(call fp_opt_quotes,$(1)) && $(_MAKE) -f $(_SDK_SRC_ROOT)../Cleanfile _SDK_SRC_ROOT=$(_SDK_SRC_ROOT)../ $(if $(BUILD_DIR),BUILD_DIR=$(BUILD_DIR)$(1)/ ,) distclean distclean_all_subdirs && cd ..
+
+distclean_all_subdirs:
+ifdef _SDK_SRC_ROOT
+ $(call hs_crossloop,$(subdirs),cd_make_distclean_all_subdirs)
+endif
+
+distclean:
+ifdef _SDK_SRC_ROOT
+ $(call rmr,obj/)
+ $(call rmr,.configs/)
+ ifndef KEEP_EWS_FILES
+ $(call rm,*.ews)
+ endif
+ $(call rm,*.Makefile)
+endif
.SILENT:
endif
+_CF_DIR =
+
include crossplatform.mk
include default.cf
$(call rmr,obj/$(PLATFORM)/)
@$(call echo,Done.)
-distclean: outputdirs
-ifndef LINUX_TARGET
- cd deps && $(MAKE) distclean
-endif
- cd ecere && $(MAKE) distclean
- cd compiler && $(MAKE) distclean
- cd ear && $(MAKE) distclean
- cd epj2make && $(MAKE) distclean
- cd ide && $(MAKE) distclean
- cd documentor && $(MAKE) distclean
-ifneq ($(ECERE_AUDIO),n)
- cd audio && $(MAKE) distclean
-endif
-ifdef CodeGuard
- cd codeGuard && $(MAKE) distclean
-endif
- cd eda && $(MAKE) distclean
- $(call rmr,obj/)
+distclean:
+ $(MAKE) -f Cleanfile distclean distclean_all_subdirs
@$(call echo,Done.)
DOC = doc
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
cd ecs && $(MAKE) realclean
distclean:
- cd bootstrap && $(MAKE) distclean
- cd libec && $(MAKE) distclean
- cd ecp && $(MAKE) distclean
- cd ecc && $(MAKE) distclean
- cd ecs && $(MAKE) distclean
+ $(MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
cd ecc && $(MAKE) realclean
cd ecs && $(MAKE) realclean
-distclean: cleantarget
- $(call rmr,obj/)
- cd ecere && $(MAKE) distclean
- cd libec && $(MAKE) distclean
- cd ecp && $(MAKE) distclean
- cd ecc && $(MAKE) distclean
- cd ecs && $(MAKE) distclean
+distclean:
+ $(MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: objdir
$(call rmr,$(OBJ))
-distclean: objdir
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: objdir
$(call rmr,$(OBJ))
-distclean: objdir
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: objdir
$(call rmr,$(OBJ))
-distclean: objdir
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: objdir
$(call rmr,$(OBJ))
-distclean: objdir
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: objdir
$(call rmr,$(OBJ))
-distclean: objdir
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile.bootstrap: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile.bootstrap: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile.bootstrap: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile.bootstrap: ;
$(_CF_DIR)crossplatform.mk: ;
endif
endif
-# MISC STRING TOOLS
+# STRING TOOLS
empty :=
esc := $(empty)\7f$(empty)
space := $(empty) $(empty)
comma := ,
+quote := "
slash := $(empty)/$(empty)
backslash := $(empty)\$(empty)
escspace = $(subst $(space),$(backslash)$(space),$(subst $(backslash)$(space),$(space),$(1)))
shwspace = $(subst $(esc),$(backslash)$(space),$(1))
unescp_all = $(subst $(esc),$(backslash),$(subst $(backslash),,$(subst $(backslash)$(backslash),$(esc),$(1))))
+# HIDDEN SPACE STRING TOOLS
+temporaty_token := _+;:;+_:;+;:_:+;+:_
+hidden_space := $(empty)\7f$(empty)
+hs_hide = $(subst $(space),$(hidden_space),$(1))
+hs_unhide = $(subst $(hidden_space),$(space),$(1))
+hs_escape = $(subst $(hidden_space),$(backslash)$(space),$(1))
+hs_process = $(subst $(space),$(hidden_space),$(subst $(backslash)$(space),$(hidden_space),$(1)))
+hs_quote_all = $(foreach item,$(1),"$(call hs_unhide,$(item))")
+hs_quote_each = $(foreach item,$(1),$(if $(findstring $(esc),$(item)),"$(call hs_unhide,$(item))",$(item)))
+
+# FILE PATH TOOLS
+fp_unquote = $(subst $(quote),,$(1))
+fp_opt_quotes = $(if $(findstring $(space),$(1)),"$(1)",$(1))
+fp_no_parent_dir = $(foreach item,$(1),$(if $(findstring ..,$(item)),,$(item)))
+
+# FILE SYSTEM TOOLS
+# hs_ls doc
+# usage: $(hs_ls) | $(hs_ls_dir) | $(hs_ls_files)
+# result:
+# - for hs_ls: a list of files and directories in the current dir
+# i.e.: fileA dir1/ fileB fileC dir2/ dir3/
+# - for hs_ls_dir: a list of directories in the current dir
+# i.e.: dir1 dir2 dir3
+# - for hs_ls_file: a list of files in the current dir
+# i.e.: fileA fileB fileC
+# notes:
+# - hs_ls* functions work in current dir, you can't specify a directory
+# - hs_ls* functions do not report hidden files and directories because wildcard doesn't
+# you would never get such a list: .fileA .dir1/
+hs_ls = $(subst $(temporaty_token),$(space),$(subst ./,,$(call hs_hide,$(subst $(space)./,$(temporaty_token),$(wildcard ./*/)))))
+hs_ls_dir = $(subst /,,$(foreach item,$(hs_ls),$(if $(findstring /,$(item)),$(item),)))
+hs_ls_file = $(foreach item,$(hs_ls),$(if $(findstring /,$(item)),,$(item)))
+
+# CONTROL FLOW TOOLS
+# hs_crossloop usage: $(call hs_crossloop,<list>,<command_function>)
+# hs_crossloop will call <command_function> with the item as first parameter ($(1))
+hs_crossloop = $(call hs_unsafe_crossloop,$(call fp_no_parent_dir,$(1)),$(2))
+
# PATH SEPARATOR STRING TOOLS
ifdef WINDOWS_HOST
ifndef MSYSCON
DEBUG_IS_ON := defined
endif
ifdef WIN_SHELL_COMMANDS
+ cd = @cd
nullerror = 2>NUL
echo = $(if $(1),echo $(1))
touch = $(if $(1),@cmd /c "for %%I in ($(call sys_path,$(1))) do @(cd %%~pI && type nul >> %%~nxI && copy /by %%~nxI+,, > nul 2>&1 && cd %%cd%%)")
rmr = $(if $(1),-rmdir /s$(if $(SILENT_IS_ON), /q,) $(call sys_path,$(1))$(if $(SILENT_IS_ON), > nul,))
mkdir = $(if $(1),-mkdir $(call sys_path,$(1))$(if $(SILENT_IS_ON), > nul,)$(if $(DEBUG_IS_ON),, 2>&1))
rmdir = $(if $(1),-rmdir$(if $(SILENT_IS_ON), /q,) $(call sys_path,$(1))$(if $(SILENT_IS_ON), > nul,))
+ hs_unsafe_crossloop = ${if $(1),${if $(2),@cmd /c "for %%I in (${call hs_quote_each,$(1)}) do ${call $(2),%%I}",},}
else
+ cd = cd
nullerror = 2>/dev/null
echo = $(if $(1),echo "$(1)")
touch = $(if $(1),touch $(1))
rmr = $(if $(1),-rm -fr$(if $(SILENT_IS_ON),,v) $(1))
mkdir = $(if $(1),-mkdir -p$(if $(SILENT_IS_ON),,v) $(1))
rmdir = $(if $(1),-rmdir$(if $(SILENT_IS_ON),, -v) $(1))
+ hs_unsafe_crossloop = ${if $(1),${if $(2),for item in ${call hs_quote_each,$(1)}; do ${call $(2),"$$item"}; done,},}
endif
# potential common use variables
cd libffi-3.0.11 && $(MAKE) realclean
distclean:
- cd freetype-2.3.12 && $(MAKE) distclean
- cd libpng-1.6.12 && $(MAKE) distclean
- cd zlib-1.2.8 && $(MAKE) distclean
- cd jpeg-9a && $(MAKE) distclean
- cd libungif-4.1.1 && $(MAKE) distclean
- cd libffi-3.0.11 && $(MAKE) distclean
+ $(MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
cd cmd && $(MAKE) realclean
distclean:
- cd extract && $(MAKE) distclean
- cd cmd && $(MAKE) distclean
+ $(MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
$(MAKE) -f Makefile.ecereCOM realclean
$(MAKE) -f Makefile.vanilla realclean
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile.bootstrap: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile.ecereCOM: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ +$(call cdmake,./,-f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs)
Makefile.installer: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile.vanilla: ;
$(_CF_DIR)crossplatform.mk: ;
endif
distclean:
- cd libeda && $(MAKE) distclean
- cd drivers && cd sqlite && $(MAKE) distclean
-ifdef EDASQLiteCipher
- cd drivers && cd sqliteCipher && $(MAKE) distclean
-endif
+ $(MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;
f.Printf("\t$(call rmdir,%s)\n", targetDirExpNoSpaces);
if(!relObjDir)
f.Puts("\t$(call rmr,obj/)\n");
+ f.Puts("\t$(call rmr,.configs/)\n");
+ f.Puts("\t$(call rm,*.ews)\n");
+ f.Puts("\t$(call rm,*.Makefile)\n");
delete f;
realclean: cleantarget
$(call rmr,$(OBJ))
-distclean: cleantarget
- $(call rmr,obj/)
+distclean:
+ $(_MAKE) -f $(_CF_DIR)Cleanfile distclean distclean_all_subdirs
Makefile: ;
$(_CF_DIR)crossplatform.mk: ;