diff --git a/.gitignore b/.gitignore
index 994bbe0..95d72f1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
bin
dockcross
*/test/
+Dockerfile
diff --git a/Dockerfile b/Dockerfile
deleted file mode 100644
index 8c8a356..0000000
--- a/Dockerfile
+++ /dev/null
@@ -1,78 +0,0 @@
-FROM debian:jessie
-MAINTAINER Matt McCormick "matt.mccormick@kitware.com"
-
-# Insert this line before "RUN apt-get update" to dynamically
-# replace httpredir.debian.org with a single working domain
-# in attempt to "prevent" the "Error reading from server" error.
-RUN apt-get update && apt-get install -y curl && \
- sed -i "s/httpredir.debian.org/`curl -s -D - http://httpredir.debian.org/demo/debian/ | awk '/^Link:/ { print $2 }' | sed -e 's@;@\1@g'`/" /etc/apt/sources.list
-
-RUN apt-get update && apt-get -y install \
- automake \
- autogen \
- bash \
- build-essential \
- bzip2 \
- ca-certificates \
- curl \
- file \
- git \
- gzip \
- libcurl4-openssl-dev \
- libssl-dev \
- make \
- ncurses-dev \
- pkg-config \
- libtool \
- python \
- rsync \
- sed \
- bison \
- flex \
- tar \
- vim \
- wget \
- runit \
- xz-utils && \
- apt-get -y clean
-
-WORKDIR /usr/share
-RUN git clone https://github.com/nojhan/liquidprompt.git && \
- cd liquidprompt && \
- git checkout v_1.11
-COPY imagefiles/.bashrc /root/
-
-# Build and install CMake from source.
-WORKDIR /usr/src
-RUN git clone git://cmake.org/cmake.git CMake && \
- cd CMake && \
- git checkout v3.6.1 && \
- cd .. && mkdir CMake-build && cd CMake-build && \
- /usr/src/CMake/bootstrap \
- --parallel=$(nproc) \
- --prefix=/usr && \
- make -j$(nproc) && \
- ./bin/cmake -DCMAKE_USE_SYSTEM_CURL:BOOL=ON \
- -DCMAKE_BUILD_TYPE:STRING=Release \
- -DCMAKE_USE_OPENSSL:BOOL=ON . && \
- make install && \
- cd .. && \
- rm -rf CMake*
-# Wrappers that point to CMAKE_TOOLCHAIN_FILE
-
-# Build and install Ninja from source
-RUN git clone https://github.com/martine/ninja.git && \
- cd ninja && \
- git checkout v1.7.1 && \
- python ./configure.py --bootstrap && \
- ./ninja && \
- cp ./ninja /usr/bin/ && \
- cd .. && rm -rf ninja
-COPY imagefiles/cmake.sh /usr/local/bin/cmake
-COPY imagefiles/ccmake.sh /usr/local/bin/ccmake
-
-RUN echo "root:root" | chpasswd
-WORKDIR /work
-ENTRYPOINT ["/dockcross/entrypoint.sh"]
-
-COPY imagefiles/entrypoint.sh imagefiles/dockcross /dockcross/
diff --git a/Dockerfile.in b/Dockerfile.in
new file mode 100644
index 0000000..9c723f4
--- /dev/null
+++ b/Dockerfile.in
@@ -0,0 +1,36 @@
+FROM debian:jessie
+MAINTAINER Matt McCormick "matt.mccormick@kitware.com"
+
+RUN apt-get update && apt-get install -y curl && \\
+ sed -i "s/httpredir.debian.org/`curl -s -D - http://httpredir.debian.org/demo/debian/ | awk '/^Link:/ { print $2 }' | sed -e 's@;@\1@g'`/" /etc/apt/sources.list
+
+RUN apt-get update && apt-get -y install \\
+ automake \\
+ autogen \\
+ bash \\
+ build-essential \\
+ bzip2 \\
+ ca-certificates \\
+ curl \\
+ file \\
+ git \\
+ gzip \\
+ libcurl4-openssl-dev \\
+ libssl-dev \\
+ make \\
+ ncurses-dev \\
+ pkg-config \\
+ libtool \\
+ python \\
+ rsync \\
+ sed \\
+ bison \\
+ flex \\
+ tar \\
+ vim \\
+ wget \\
+ runit \\
+ xz-utils && \\
+ apt-get -y clean
+
+#include "common.docker"
diff --git a/Makefile b/Makefile
index 99dd453..6224294 100644
--- a/Makefile
+++ b/Makefile
@@ -71,6 +71,13 @@ linux-ppc64le.test: linux-ppc64le test/run.py
$(DOCKER) run --rm dockcross/linux-ppc64le > $(BIN)/dockcross-linux-ppc64le && chmod +x $(BIN)/dockcross-linux-ppc64le
$(BIN)/dockcross-linux-ppc64le python test/run.py --languages C
+manylinux-x64: base manylinux-x64/Dockerfile
+ $(DOCKER) build -t $(ORG)/manylinux-x64 manylinux-x64
+
+manylinux-x64.test: manylinux-x64 test/run.py
+ $(DOCKER) run --rm dockcross/manylinux-x64 > $(BIN)/dockcross-manylinux-x64 && chmod +x $(BIN)/dockcross-manylinux-x64
+ $(BIN)/dockcross-manylinux-x64 python test/run.py
+
windows-x86: base windows-x86/Dockerfile windows-x86/settings.mk
$(DOCKER) build -t $(ORG)/windows-x86 windows-x86
@@ -85,6 +92,9 @@ windows-x64.test: windows-x64 test/run.py
$(DOCKER) run --rm dockcross/windows-x64 > $(BIN)/dockcross-windows-x64 && chmod +x $(BIN)/dockcross-windows-x64
$(BIN)/dockcross-windows-x64 python test/run.py --exe-suffix ".exe"
+Dockerfile: Dockerfile.in common.docker
+ cpp -o Dockerfile Dockerfile.in
+
base: Dockerfile
$(DOCKER) build -t $(ORG)/base .
diff --git a/common.docker b/common.docker
new file mode 100644
index 0000000..0acc314
--- /dev/null
+++ b/common.docker
@@ -0,0 +1,37 @@
+WORKDIR /usr/share
+RUN git clone "https://github.com/nojhan/liquidprompt.git" && \\
+ cd liquidprompt && \\
+ git checkout v_1.11
+COPY imagefiles/.bashrc /root/
+
+WORKDIR /usr/src
+RUN git clone "https://cmake.org/cmake.git" CMake && \\
+ cd CMake && \\
+ git checkout v3.6.1 && \\
+ cd .. && mkdir CMake-build && cd CMake-build && \\
+ /usr/src/CMake/bootstrap \\
+ --parallel=$(nproc) \\
+ --prefix=/usr && \\
+ make -j$(nproc) && \\
+ ./bin/cmake -DCMAKE_USE_SYSTEM_CURL:BOOL=ON \\
+ -DCMAKE_BUILD_TYPE:STRING=Release \\
+ -DCMAKE_USE_OPENSSL:BOOL=ON . && \\
+ make install && \\
+ cd .. && \\
+ rm -rf CMake*
+
+RUN git clone "https://github.com/martine/ninja.git" && \\
+ cd ninja && \\
+ git checkout v1.7.1 && \\
+ python ./configure.py --bootstrap && \\
+ ./ninja && \\
+ cp ./ninja /usr/bin/ && \\
+ cd .. && rm -rf ninja
+COPY imagefiles/cmake.sh /usr/local/bin/cmake
+COPY imagefiles/ccmake.sh /usr/local/bin/ccmake
+
+RUN echo "root:root" | chpasswd
+WORKDIR /work
+ENTRYPOINT ["/dockcross/entrypoint.sh"]
+
+COPY imagefiles/entrypoint.sh imagefiles/dockcross /dockcross/