1ec380ad61
* Set the PIPE_REJECT_REMOTE_CLIENTS flag on Vista and up. * Set a DACL on named pipes that gives full control to the built-in administrators, the local system account, and the current security token's owner SID. This is the same DACL that is used by default, except that the default also grants read access to the Everyone group and the anonymous account. * Also define WINVER=0x0501, because MinGW's sddl.h only defines ConvertSidToStringSidW and ConvertStringSidToSidW if WINVER is defined. (Ordinarily, defining _WIN32_WINNT is sufficient, and it's even sufficient with the i686-pc-mingw32-g++ compiler packaged with Cygwin.) * The createSecurityDescriptorOwnerFullControlEveryoneWrite function is not currently used (or tested), but I think I'll use it in the debug server to allow collecting trace output from other accounts on the machine. (I think I'll make that behavior optional.) I tested this commit with all of the supported compilers: MSYS1 MinGW, Cygwin MinGW, MSYS2 MinGW-w64, Cygwin MinGW-w64, MSVC2013, and MSVC2015. The code compiles and runs in all of them. I also examined the DACL attached to the control pipe, and its SDDL string looked correct.
88 lines
2.6 KiB
Makefile
88 lines
2.6 KiB
Makefile
# Copyright (c) 2011-2015 Ryan Prichard
|
|
#
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
# of this software and associated documentation files (the "Software"), to
|
|
# deal in the Software without restriction, including without limitation the
|
|
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
# sell copies of the Software, and to permit persons to whom the Software is
|
|
# furnished to do so, subject to the following conditions:
|
|
#
|
|
# The above copyright notice and this permission notice shall be included in
|
|
# all copies or substantial portions of the Software.
|
|
#
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
# IN THE SOFTWARE.
|
|
|
|
# Use make -n to see the actual command-lines make would run.
|
|
|
|
default : all
|
|
|
|
PREFIX ?= /usr/local
|
|
UNIX_ADAPTER_EXE ?= console.exe
|
|
|
|
# Include config.mk but complain if it hasn't been created yet.
|
|
ifeq "$(wildcard config.mk)" ""
|
|
$(error config.mk does not exist. Please run ./configure)
|
|
endif
|
|
|
|
MINGW_OPTIMIZATION_FLAGS ?= -O2
|
|
|
|
include config.mk
|
|
|
|
COMMON_CXXFLAGS += \
|
|
-DWINPTY_VERSION=$$(cat VERSION.txt | tr -d '\r\n') \
|
|
-DWINPTY_VERSION_SUFFIX=$(VERSION_SUFFIX) \
|
|
-DWINPTY_COMMIT_HASH=$(COMMIT_HASH) \
|
|
-MMD -Wall \
|
|
-DUNICODE \
|
|
-D_UNICODE \
|
|
-DWINVER=0x0501 \
|
|
-D_WIN32_WINNT=0x0501
|
|
|
|
UNIX_CXXFLAGS += \
|
|
$(COMMON_CXXFLAGS)
|
|
|
|
MINGW_CXXFLAGS += \
|
|
$(COMMON_CXXFLAGS) \
|
|
$(MINGW_OPTIMIZATION_FLAGS) \
|
|
-std=c++11
|
|
|
|
MINGW_LDFLAGS += -static -static-libgcc -static-libstdc++
|
|
UNIX_LDFLAGS += $(UNIX_LDFLAGS_STATIC)
|
|
|
|
include src/subdir.mk
|
|
|
|
all : $(ALL_TARGETS)
|
|
|
|
tests : $(TEST_PROGRAMS)
|
|
|
|
install : all
|
|
mkdir -p $(PREFIX)/bin
|
|
install -m 755 -p -s build/$(UNIX_ADAPTER_EXE) $(PREFIX)/bin
|
|
install -m 755 -p -s build/winpty.dll $(PREFIX)/bin
|
|
install -m 755 -p -s build/winpty-agent.exe $(PREFIX)/bin
|
|
install -m 755 -p -s build/winpty-debugserver.exe $(PREFIX)/bin
|
|
|
|
clean :
|
|
rm -fr build
|
|
|
|
distclean : clean
|
|
rm -f config.mk
|
|
|
|
.PHONY : default all tests install clean distclean
|
|
|
|
build/mingw/%.o : src/%.cc VERSION.txt
|
|
@echo Compiling $<
|
|
@mkdir -p $$(dirname $@)
|
|
@$(MINGW_CXX) $(MINGW_CXXFLAGS) -I src/include -c -o $@ $<
|
|
|
|
build/unix/%.o : src/%.cc VERSION.txt
|
|
@echo Compiling $<
|
|
@mkdir -p $$(dirname $@)
|
|
@$(UNIX_CXX) $(UNIX_CXXFLAGS) -I src/include -c -o $@ $<
|