2015-08-21 10:04:50 +03:00
|
|
|
# Unicorn Engine
|
|
|
|
# By Nguyen Anh Quynh & Dang Hoang Vu, 2015
|
2016-11-19 12:17:48 +03:00
|
|
|
DIFF = diff
|
2015-08-21 10:04:50 +03:00
|
|
|
|
2016-11-19 12:17:48 +03:00
|
|
|
SAMPLE_SOURCE = $(wildcard ../samples/*.c)
|
|
|
|
SAMPLE = $(SAMPLE_SOURCE:../samples/%.c=%)
|
|
|
|
SAMPLE := $(SAMPLE:mem_apis=)
|
|
|
|
SAMPLE := $(SAMPLE:sample_batch_reg=)
|
|
|
|
SAMPLE := $(SAMPLE:sample_x86_32_gdt_and_seg_regs=)
|
|
|
|
SAMPLE := $(SAMPLE:shellcode=)
|
2015-08-21 10:04:50 +03:00
|
|
|
|
2016-12-26 10:54:46 +03:00
|
|
|
UNAME_S := $(shell uname -s)
|
|
|
|
ifeq ($(UNAME_S), Linux)
|
2016-12-26 10:12:48 +03:00
|
|
|
ENV_VARS = LD_PRELOAD=librt.so LD_LIBRARY_PATH=../ DYLD_LIBRARY_PATH=../
|
2016-12-26 10:54:46 +03:00
|
|
|
else
|
2017-12-17 14:24:09 +03:00
|
|
|
ENV_VARS = LD_LIBRARY_PATH=../ DYLD_LIBRARY_PATH=../ LIBUNICORN_PATH=$(TRAVIS_BUILD_DIR)
|
2016-12-26 10:54:46 +03:00
|
|
|
endif
|
|
|
|
|
Unit testing in CI (#651)
- in appveyor, install clang and cmake in cygwin, enable package upgrades, and build cmocka and enable testing for gcc only
- in `gitignore`, ignore generated cmocka folder
- in travis, use brew in osx to install cmocka, and enable testing for gcc and clang on os x and linux
- in `Makefile`, change to use `uname -s` to determine os type
- make `install-cmocka-linux.sh`, a simple shell script to download and install cmocka on linux
- in `bindings/Makefile`, enable `make -c` to call subdirectory makefiles instead of `cd [dir] && make` and include environment variables for runtime access to generated libraries
- in `samples/Makefile`, change to use `uname -s` to determine os type, remove `clean_bins` from `all` command, and include `Werror` for compile strictness
- in `tests/unit/Makefile`, add `cflags` for compile time access to cmocka headers and library, include execute vars for runtime access to cmocka and unicorn libs
- in `tests/unit/test_tb_x86.c`, comment out assert that would not compile
2016-10-21 19:21:10 +03:00
|
|
|
|
2016-11-19 12:17:48 +03:00
|
|
|
.PHONY: build install python c clean check test
|
2015-08-21 10:04:50 +03:00
|
|
|
|
2016-04-08 12:29:43 +03:00
|
|
|
build:
|
Unit testing in CI (#651)
- in appveyor, install clang and cmake in cygwin, enable package upgrades, and build cmocka and enable testing for gcc only
- in `gitignore`, ignore generated cmocka folder
- in travis, use brew in osx to install cmocka, and enable testing for gcc and clang on os x and linux
- in `Makefile`, change to use `uname -s` to determine os type
- make `install-cmocka-linux.sh`, a simple shell script to download and install cmocka on linux
- in `bindings/Makefile`, enable `make -c` to call subdirectory makefiles instead of `cd [dir] && make` and include environment variables for runtime access to generated libraries
- in `samples/Makefile`, change to use `uname -s` to determine os type, remove `clean_bins` from `all` command, and include `Werror` for compile strictness
- in `tests/unit/Makefile`, add `cflags` for compile time access to cmocka headers and library, include execute vars for runtime access to cmocka and unicorn libs
- in `tests/unit/test_tb_x86.c`, comment out assert that would not compile
2016-10-21 19:21:10 +03:00
|
|
|
$(MAKE) -C python gen_const
|
|
|
|
$(MAKE) -C go gen_const
|
|
|
|
$(MAKE) -C java gen_const
|
2016-10-22 18:02:35 +03:00
|
|
|
$(MAKE) -C ruby gen_const
|
2021-10-26 14:10:59 +03:00
|
|
|
python3 const_generator.py dotnet
|
|
|
|
python3 const_generator.py pascal
|
2015-08-21 10:04:50 +03:00
|
|
|
|
2016-04-08 12:29:43 +03:00
|
|
|
install: build
|
Unit testing in CI (#651)
- in appveyor, install clang and cmake in cygwin, enable package upgrades, and build cmocka and enable testing for gcc only
- in `gitignore`, ignore generated cmocka folder
- in travis, use brew in osx to install cmocka, and enable testing for gcc and clang on os x and linux
- in `Makefile`, change to use `uname -s` to determine os type
- make `install-cmocka-linux.sh`, a simple shell script to download and install cmocka on linux
- in `bindings/Makefile`, enable `make -c` to call subdirectory makefiles instead of `cd [dir] && make` and include environment variables for runtime access to generated libraries
- in `samples/Makefile`, change to use `uname -s` to determine os type, remove `clean_bins` from `all` command, and include `Werror` for compile strictness
- in `tests/unit/Makefile`, add `cflags` for compile time access to cmocka headers and library, include execute vars for runtime access to cmocka and unicorn libs
- in `tests/unit/test_tb_x86.c`, comment out assert that would not compile
2016-10-21 19:21:10 +03:00
|
|
|
$(MAKE) -C python install
|
|
|
|
$(MAKE) -C java install
|
2016-04-08 12:29:43 +03:00
|
|
|
|
2016-11-19 12:17:48 +03:00
|
|
|
test: $(SAMPLE:%=%.py.test)
|
2015-08-21 10:04:50 +03:00
|
|
|
|
2016-11-19 12:17:48 +03:00
|
|
|
c:
|
Unit testing in CI (#651)
- in appveyor, install clang and cmake in cygwin, enable package upgrades, and build cmocka and enable testing for gcc only
- in `gitignore`, ignore generated cmocka folder
- in travis, use brew in osx to install cmocka, and enable testing for gcc and clang on os x and linux
- in `Makefile`, change to use `uname -s` to determine os type
- make `install-cmocka-linux.sh`, a simple shell script to download and install cmocka on linux
- in `bindings/Makefile`, enable `make -c` to call subdirectory makefiles instead of `cd [dir] && make` and include environment variables for runtime access to generated libraries
- in `samples/Makefile`, change to use `uname -s` to determine os type, remove `clean_bins` from `all` command, and include `Werror` for compile strictness
- in `tests/unit/Makefile`, add `cflags` for compile time access to cmocka headers and library, include execute vars for runtime access to cmocka and unicorn libs
- in `tests/unit/test_tb_x86.c`, comment out assert that would not compile
2016-10-21 19:21:10 +03:00
|
|
|
$(MAKE) -C ../samples
|
2016-11-19 12:17:48 +03:00
|
|
|
python:
|
Unit testing in CI (#651)
- in appveyor, install clang and cmake in cygwin, enable package upgrades, and build cmocka and enable testing for gcc only
- in `gitignore`, ignore generated cmocka folder
- in travis, use brew in osx to install cmocka, and enable testing for gcc and clang on os x and linux
- in `Makefile`, change to use `uname -s` to determine os type
- make `install-cmocka-linux.sh`, a simple shell script to download and install cmocka on linux
- in `bindings/Makefile`, enable `make -c` to call subdirectory makefiles instead of `cd [dir] && make` and include environment variables for runtime access to generated libraries
- in `samples/Makefile`, change to use `uname -s` to determine os type, remove `clean_bins` from `all` command, and include `Werror` for compile strictness
- in `tests/unit/Makefile`, add `cflags` for compile time access to cmocka headers and library, include execute vars for runtime access to cmocka and unicorn libs
- in `tests/unit/test_tb_x86.c`, comment out assert that would not compile
2016-10-21 19:21:10 +03:00
|
|
|
$(MAKE) -C python
|
2016-11-19 12:17:48 +03:00
|
|
|
%.c.txt: c
|
|
|
|
$(ENV_VARS) ../samples/$(@:%.c.txt=%) > $@
|
|
|
|
%.py.txt: python
|
2021-10-26 14:10:59 +03:00
|
|
|
$(ENV_VARS) python3 python/$(@:%.txt=%) > $@
|
2015-08-21 10:04:50 +03:00
|
|
|
|
2016-11-19 12:17:48 +03:00
|
|
|
%.py.test: %.c.txt %.py.txt
|
2017-02-26 11:52:06 +03:00
|
|
|
$(DIFF) -u $(@:%.py.test=%.c.txt) $(@:%.py.test=%.py.txt)
|
2015-08-21 10:04:50 +03:00
|
|
|
|
|
|
|
clean:
|
2016-11-19 12:17:48 +03:00
|
|
|
# rm -rf *.txt
|
Unit testing in CI (#651)
- in appveyor, install clang and cmake in cygwin, enable package upgrades, and build cmocka and enable testing for gcc only
- in `gitignore`, ignore generated cmocka folder
- in travis, use brew in osx to install cmocka, and enable testing for gcc and clang on os x and linux
- in `Makefile`, change to use `uname -s` to determine os type
- make `install-cmocka-linux.sh`, a simple shell script to download and install cmocka on linux
- in `bindings/Makefile`, enable `make -c` to call subdirectory makefiles instead of `cd [dir] && make` and include environment variables for runtime access to generated libraries
- in `samples/Makefile`, change to use `uname -s` to determine os type, remove `clean_bins` from `all` command, and include `Werror` for compile strictness
- in `tests/unit/Makefile`, add `cflags` for compile time access to cmocka headers and library, include execute vars for runtime access to cmocka and unicorn libs
- in `tests/unit/test_tb_x86.c`, comment out assert that would not compile
2016-10-21 19:21:10 +03:00
|
|
|
$(MAKE) -C python clean
|
|
|
|
$(MAKE) -C java clean
|
2015-08-21 10:04:50 +03:00
|
|
|
|
|
|
|
check:
|
|
|
|
make -C python check
|