diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2021-10-30 08:19:59 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2021-10-30 09:05:41 +0200 |
commit | d2da14d0ff0cb22d6d275938ee26855d6ce44987 (patch) | |
tree | 418ccc7f1786b9f250985f55bfbf3a942911f77a | |
parent | 67f055022462ddfa416b8ff68874326138ca4978 (diff) |
Fix CircleCI build.
* README update
* make help
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rw-r--r-- | .circleci/config.yml | 7 | ||||
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | Makefile.deps | 6 | ||||
-rw-r--r-- | Makefile.inc | 9 | ||||
-rw-r--r-- | Makefile.native.inc | 8 | ||||
-rw-r--r-- | README.md | 72 |
6 files changed, 84 insertions, 21 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml index 655a282..b9852e1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -16,6 +16,13 @@ jobs: binutils-mingw-w64-x86-64 gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 mingw-w64-x86-64-dev - run: | env DEBIAN_FRONTEND=noninteractive \ + make -C . -f Makefile.deps all \ + WERROR=1 Q= \ + CC=/usr/bin/x86_64-w64-mingw32-gcc \ + CXX=/usr/bin/x86_64-w64-mingw32-g++ \ + DDK_INCLUDE_DIR=/usr/x86_64-w64-mingw32/include/ddk + - run: | + env DEBIAN_FRONTEND=noninteractive \ make install \ WERROR=1 Q= \ CC=/usr/bin/x86_64-w64-mingw32-gcc \ @@ -52,5 +52,8 @@ clean: rm -f $(2_OBJECTS) $(2_TARGET) $(2_TARGET).map rm -f $(3_OBJECTS) $(3_TARGET) $(3_TARGET).map +help: + $(call HELP_MAKE_OPTIONS) + .PHONY: all install distclean clean .DEFAULT_GOAL := all diff --git a/Makefile.deps b/Makefile.deps index d3bc94d..1a1c1fe 100644 --- a/Makefile.deps +++ b/Makefile.deps @@ -136,5 +136,9 @@ clean: $(EASTL_STATIC_LIB) endif -.PHONY: all deps-print-local-notice deps-build deps distclean clean +help: + @echo '[Makefile.deps]' + $(call HELP_MAKE_OPTIONS) + +.PHONY: all deps-print-local-notice deps-build deps distclean clean help .DEFAULT_GOAL := all diff --git a/Makefile.inc b/Makefile.inc index 2f99ffd..111ff94 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -202,3 +202,12 @@ define INSTALL_EXEC_SIGN done $(INSTALL) "$(DPP_ROOT)/$(SIGNTOOL_PREFIX)-ca-cert.pem" '$(DESTDIR)/$(SIGNTOOL_PREFIX)-ca-cert.crt' endef + +define HELP_MAKE_OPTIONS + @echo 'Common make options for Makefile.inc:' + @echo -e '\tBUILD_NATIVE = no' + @echo -e '\tCC = $(CC)' + @echo -e '\tCXX = $(CXX)' + @echo -e '\tDDK_INCLUDE_DIR = $(DDK_INCLUDE_DIR)' + @echo -e '\tDPP_ROOT = $(DPP_ROOT)' +endef diff --git a/Makefile.native.inc b/Makefile.native.inc index c10e34e..95ed10a 100644 --- a/Makefile.native.inc +++ b/Makefile.native.inc @@ -123,6 +123,10 @@ define INSTALL_EXEC_SIGN $(error BUILD_NATIVE does not support code signing.) endef -define CHECK_DPP - $(MAKE) -C $(DPP_ROOT) -f Makefile.deps all +define HELP_MAKE_OPTIONS + @echo 'Common make options for Makefile.native.inc:' + @echo -e '\tBUILD_NATIVE = yes' + @echo -e '\tCC = $(CC)' + @echo -e '\tCXX = $(CXX)' + @echo -e '\tDPP_ROOT = $(DPP_ROOT)' endef @@ -10,7 +10,8 @@ beloved containers. You will need an modern Mingw64-GCC toolchain. Do not use any broken toolchains like the one shipped with debian-10. -Instead either use Zeranoe's build script with `make deps` or use your own. +Mingw64-GCC for debian-11 seems to work, but is not well tested. +Instead either use Zeranoe's build script with `make -C [path-to-this-repo] -f Makefile.deps all` or use your own. ## What? @@ -22,20 +23,15 @@ Instead either use Zeranoe's build script with `make deps` or use your own. Build all examples with a Mingw64 toolchain using Zeranoe's build script: -`` -make all -`` +``` +make -C [path-to-this-repo] -f Makefile.deps all # build toolchain, CRT, CRT++ and EASTL +make -C [path-to-this-repo] all # build examples +``` Build all examples with your own Mingw64 toolchain: `` -make all CC=path/to/bin/x86_64-w64-mingw32-gcc DDK_INCLUDE_DIR=path/to/include/ddk -`` - -Build Mingw64 only: - -`` -make deps +make all CC=path/to/bin/x86_64-w64-mingw32-gcc CXX=path/to/bin/x86_64-w64-mingw32-g++ DDK_INCLUDE_DIR=path/to/include/ddk `` ## HowTo use it in your own project @@ -44,16 +40,16 @@ At the moment only a **GMake** build system is supported. A minimal working **Makefile** for your own project could look alike: ```make -DRIVER_NAME = Driver -DRIVER_OBJECTS = $(DRIVER_NAME).opp -DRIVER_TARGET = $(DRIVER_NAME).sys - ifndef DPP_ROOT $(error DPP_ROOT is undefined) endif include $(DPP_ROOT)/Makefile.inc +DRIVER_NAME = Driver +DRIVER_OBJECTS = $(DRIVER_NAME).opp +DRIVER_TARGET = $(DRIVER_NAME).sys + %.opp: %.cpp $(call BUILD_CPP_OBJECT,$<,$@) @@ -73,8 +69,8 @@ install: $(DRIVER_TARGET) You can also add the toolchain to your path and use it for other projects w/o any Makefile blueprint: ``` -make -source path/to/bin/mingw-w64-ddk-template/x86_64-w64-mingw32-gcc/bin/activate.sh +make -C [path-to-this-repo] -f Makefile.deps all +source [path-to-this-repo]/w64-mingw32-sysroot/x86_64/activate.sh ``` ## The CRT and CRT++ @@ -98,7 +94,47 @@ Make sure that the symbol `DriverUnload` exists and has the usual ddk function s `void DriverUnload(_In_ struct _DRIVER_OBJECT * DriverObject)`. This is required to make ctors/dtors work without calling additional functions in `DriverEntry` / `DriverUnload`. -## Thanks! +## Host EASTL/CRT/CRT++ Build + +It is possible to build parts of the repository for your host distribution. +To do that simply type: + +`` +make -C [path-to-this-repo] -f Makefile.deps -j1 all BUILD_NATIVE=1 +`` + +You can use the Host Build in your Makefile based project with: + +``` +ifndef DPP_ROOT +$(error DPP_ROOT is undefined) +endif + +ifndef BUILD_NATIVE +include $(DPP_ROOT)/Makefile.inc +else +include $(DPP_ROOT)/Makefile.native.inc +endif + +DRIVER_NAME = Driver +DRIVER_OBJECTS = $(DRIVER_NAME).opp +DRIVER_TARGET = $(DRIVER_NAME).sys + +USERSPACE_NAME = usa$(NAME_SUFFIX) +USERSPACE_OBJECTS = $(USERSPACE_NAME).opp +USERSPACE_TARGET = $(USERSPACE_NAME).exe + +%.opp: %.cpp + $(call BUILD_CPP_OBJECT,$<,$@) + +$(DRIVER_TARGET): $(DRIVER_OBJECTS) + $(call LINK_CPP_KERNEL_TARGET,$(DRIVER_OBJECTS),$@) + +$(USERSPACE_TARGET): $(USERSPACE_OBJECTS) + $(call LINK_CPP_USER_TARGET,$(USERSPACE_OBJECTS),$@) +``` + +## Thanks goes to: - [Zeranoe](https://github.com/Zeranoe/mingw-w64-build) for the Mingw64 build script - [sidyhe](https://github.com/sidyhe/dxx) for some copy paste ready CRT code ;) |