Skip to content

Commit

Permalink
Improves Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
kenorb committed Sep 18, 2024
1 parent ca60d77 commit 101a3da
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 101a3da

Please sign in to comment.