2015-08-21 07:04:50 +00:00
|
|
|
# Unicorn Engine
|
|
|
|
# By Nguyen Anh Quynh & Dang Hoang Vu, 2015
|
2016-11-19 09:17:48 +00:00
|
|
|
DIFF = diff
|
2015-08-21 07:04:50 +00:00
|
|
|
|
2016-11-19 09:17:48 +00: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 07:04:50 +00:00
|
|
|
|
2016-12-26 07:54:46 +00:00
|
|
|
UNAME_S := $(shell uname -s)
|
|
|
|
ifeq ($(UNAME_S), Linux)
|
2016-12-26 07:12:48 +00:00
|
|
|
ENV_VARS = LD_PRELOAD=librt.so LD_LIBRARY_PATH=../ DYLD_LIBRARY_PATH=../
|
2016-12-26 07:54:46 +00:00
|
|
|
else
|
|
|
|
ENV_VARS = LD_LIBRARY_PATH=../ DYLD_LIBRARY_PATH=../
|
|
|
|
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 16:21:10 +00:00
|
|
|
|
2016-11-19 09:17:48 +00:00
|
|
|
.PHONY: build install python c clean check test
|
2015-08-21 07:04:50 +00:00
|
|
|
|
2016-04-08 09:29:43 +00: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 16:21:10 +00:00
|
|
|
$(MAKE) -C python gen_const
|
|
|
|
$(MAKE) -C go gen_const
|
|
|
|
$(MAKE) -C java gen_const
|
2016-10-22 15:02:35 +00:00
|
|
|
$(MAKE) -C ruby gen_const
|
2015-10-15 08:23:14 +00:00
|
|
|
python const_generator.py dotnet
|
2015-08-21 07:04:50 +00:00
|
|
|
|
2016-04-08 09:29:43 +00: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 16:21:10 +00:00
|
|
|
$(MAKE) -C python install
|
|
|
|
$(MAKE) -C java install
|
2016-04-08 09:29:43 +00:00
|
|
|
|
2016-11-19 09:17:48 +00:00
|
|
|
test: $(SAMPLE:%=%.py.test)
|
2015-08-21 07:04:50 +00:00
|
|
|
|
2016-11-19 09:17:48 +00: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 16:21:10 +00:00
|
|
|
$(MAKE) -C ../samples
|
2016-11-19 09:17:48 +00: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 16:21:10 +00:00
|
|
|
$(MAKE) -C python
|
2016-11-19 09:17:48 +00:00
|
|
|
%.c.txt: c
|
|
|
|
$(ENV_VARS) ../samples/$(@:%.c.txt=%) > $@
|
|
|
|
%.py.txt: python
|
|
|
|
$(ENV_VARS) python python/$(@:%.txt=%) > $@
|
2015-08-21 07:04:50 +00:00
|
|
|
|
2016-11-19 09:17:48 +00:00
|
|
|
%.py.test: %.c.txt %.py.txt
|
|
|
|
$(DIFF) $(@:%.py.test=%.c.txt) $(@:%.py.test=%.py.txt)
|
2015-08-21 07:04:50 +00:00
|
|
|
|
|
|
|
clean:
|
2016-11-19 09:17:48 +00: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 16:21:10 +00:00
|
|
|
$(MAKE) -C python clean
|
|
|
|
$(MAKE) -C java clean
|
2015-08-21 07:04:50 +00:00
|
|
|
|
|
|
|
check:
|
|
|
|
make -C python check
|