winpty/Makefile
Ryan Prichard 0fb98c03fa Recompile everything if VERSION.txt changes
The contents of that file are included on the compiler command-line for
every file.
2015-12-28 21:57:11 -06:00

85 lines
2.5 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
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 \
-D_WIN32_WINNT=0x0501
UNIX_CXXFLAGS += \
$(COMMON_CXXFLAGS)
MINGW_CXXFLAGS += \
$(COMMON_CXXFLAGS) \
-fno-exceptions \
-fno-rtti \
-O2
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 $@ $<