From 101a3da80f22b72e78374b98e532723dbe91c767 Mon Sep 17 00:00:00 2001 From: kenorb Date: Wed, 18 Sep 2024 20:29:50 +0100 Subject: [PATCH] Improves Makefile --- Makefile | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index d8c1fdb97..c432baf65 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,25 @@ CFLAGS := -Wall -Wextra -std=c++17 -w # Compiler flags EMCC_CFLAGS := $(CFLAGS) --bind -s ASSERTIONS=1 -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s EXIT_RUNTIME=0 -s EXPORTED_FUNCTIONS="[]" -s WASM=1 -s MODULARIZE=1 -s NO_EXIT_RUNTIME=1 -MAKEFILES := $(wildcard **/tests/Makefile) +MAKEFILES := $(wildcard **/tests/Makefile) # $(wildcard **/**/tests/Makefile) -.PHONY: all +# Check if the system is Linux +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S),Linux) + WINE := wine + # Set WINEPATH to include MetaTrader directory. + export WINEPATH := $(WINEPATH);"C:\Program Files\MetaTrader 4;C:\Program Files\MetaTrader 5" +else + WINE := +endif -all: $(MAKEFILES) +.PHONY: all cpp mql mql4 mql5 + +all: cpp + +cpp mql mql4 mql5: $(MAKEFILES) @ret=0; \ for makefile in $(MAKEFILES); do \ - $(MAKE) -C $$(dirname $$makefile) CFLAGS="$(CFLAGS)" EMCC_CFLAGS="$(EMCC_CFLAGS)" || { ret=$$?; }; \ + $(MAKE) -C $$(dirname $$makefile) WINE='$(WINE)' WINEPATH='$(WINEPATH)' $@ || { ret=$$?; }; \ done; \ exit $$ret