MAKE := make CC32 := gcc -m32 CC64 := gcc -m64 ifneq ($(WIN32),) CC32 := i686-w64-mingw32-gcc SF32 := .exe endif ifneq ($(WIN64),) CC64 := x86_64-w64-mingw32-gcc SF64 := .exe endif RM := rm CFLAGS := -Wall -std=gnu99 -Os ifneq ($(NOPASTA),) CFLAGS += -D_NOPASTA=1337 endif ifneq ($(DEBUG),) CFLAGS += -g -D_DEBUG=1 else CFLAGS += -s endif ifneq ($(STATIC),) CFLAGS += -static -ffunction-sections -fdata-sections -flto endif ifneq ($(SF32),) INTERP32 := wine endif ifneq ($(SF64),) INTERP64 := wine endif all: example_x86$(SF32) example_x64$(SF64) example_x86$(SF32): funccrypt.h funccrypt.c example.c $(CC32) $(CFLAGS) $^ -o $@ example_x64$(SF64): funccrypt.h funccrypt.c example.c $(CC64) $(CFLAGS) $^ -o $@ test: all @printf '\n%s\n' './example_x86$(SF32)' test -x example_x86$(SF32) && $(INTERP32) ./example_x86$(SF32) @printf '\n%s\n' './example_x86$(SF64)' test -x example_x64$(SF64) && $(INTERP64) ./example_x64$(SF64) full: @printf '\n%s\n' '******************' @printf '%s\n' '*** HOST BUILD ***' @printf '%s\n\n' '******************' -$(MAKE) all @printf '\n%s\n' '*******************' @printf '%s\n' '*** MINGW BUILD ***' @printf '%s\n\n' '*******************' -$(MAKE) all WIN32=1 WIN64=1 @printf '\n%s\n' '*****************' @printf '%s\n' '*** HOST TEST ***' @printf '%s\n\n' '*****************' -$(MAKE) test @printf '\n%s\n' '******************' @printf '%s\n' '*** MINGW TEST ***' @printf '%s\n\n' '******************' -$(MAKE) test WIN32=1 WIN64=1 full-clean: -$(MAKE) clean -$(MAKE) clean WIN32=1 WIN64=1 clean: $(RM) -f example_x86$(SF32) example_x64$(SF64)