This Makefile automates the process of building x3270 suite binaries (s3270, x3270if, etc.) for Linux and Windows platforms.
- GCC and build tools
- Git
- Make
- MinGW-w64 cross-compiler (automatically installed if missing)
- The Makefile will install MinGW if needed using:
sudo apt-get install mingw-w64
Build all binaries for both platforms:
makeThis will:
- Clone the x3270 repository from https://github.com/pmattes/x3270
- Checkout version 4.4ga6 (configurable)
- Build Linux binaries (s3270, x3270if, x3270)
- Build Windows binaries (s3270.exe, x3270if.exe, ws3270.exe, wc3270.exe)
- Strip binaries to reduce size
- Test all binaries
- Save version info to
.x3270_version
Build Linux binaries only:
make linuxBuild Windows binaries only:
make windowsSpecify a different x3270 version:
make X3270_VERSION=4.3ga10 allThe Makefile tracks the last built version in .x3270_version. If you try to build the same version again, it will skip the build unless you run make deepclean first.
Test that all binaries are present and working:
make test-binariesSafe clean (removes built binaries, keeps source):
make cleanDeep clean (removes everything including cloned source):
make deepcleanForce rebuild of the same version:
make deepclean
makeShow all available targets and current configuration:
make helpbinaries/
├── linux/ # Linux binaries
│ ├── s3270 # Scripting version
│ ├── x3270if # Interface program
│ └── x3270 # Full version
└── windows/ # Windows binaries
├── s3270.exe # Scripting version
├── x3270if.exe # Interface program
├── ws3270.exe # Windows scripting version
└── wc3270.exe # Windows console version
- Clones x3270 repository to
/tmp/x3270-build - Runs
./configure --prefix=/usr/local --enable-s3270 --enable-x3270if - Builds using
make -j$(nproc)for parallel compilation - Copies binaries to
binaries/linux/ - Strips binaries to reduce size
- Sets executable permissions
- Checks for MinGW cross-compiler, installs if missing
- Runs
./configure --host=x86_64-w64-mingw32 --prefix=/usr/local --enable-s3270 --enable-x3270if - Builds using
make -j$(nproc)for parallel compilation - Copies binaries to
binaries/windows/ - Strips binaries using MinGW strip tool
Note: Windows cross-compilation from Linux may fail due to missing dependencies (libiconv, OpenSSL for MinGW). If the build fails:
- Use the existing pre-built Windows binaries already in the repository
- Build natively on Windows using Visual Studio or MinGW
- Use the VisualStudio project files included in the x3270 repository
The Makefile maintains a .x3270_version file that records the last successfully built version. This prevents redundant rebuilds when you run make multiple times with the same version.
To check the current version:
make helpX3270_VERSION: x3270 version to build (default: 4.4ga6)X3270_REPO: Repository URL (default: https://github.com/pmattes/x3270)X3270_DIR: Build directory (default: /tmp/x3270-build)BINARIES_LINUX: Linux binaries output directory (default: binaries/linux)BINARIES_WINDOWS: Windows binaries output directory (default: binaries/windows)
If the build fails, check:
- All prerequisites are installed
- Internet connection is available for cloning
- Disk space is sufficient in
/tmp
Clean and retry:
make deepclean
makeWindows builds may fail on Linux due to missing MinGW dependencies:
libiconvfor MinGWOpenSSLfor MinGW- Other Windows-specific libraries
Solutions:
- Use the pre-built Windows binaries already in the repository
- Build on Windows natively (recommended for Windows binaries)
- Install additional MinGW libraries (if available for your distribution)
For native Windows builds, use:
- Visual Studio project files in the x3270 repository's
VisualStudio/directory - MinGW-w64 with MSYS2 on Windows
- Windows Subsystem for Linux (WSL) with native Windows toolchain
If some binaries are missing after build, the x3270 version might not include all components. Check the x3270 release notes for the version you're building.
If binaries aren't executable:
chmod +x binaries/linux/*
chmod +x binaries/windows/*After building binaries, regenerate the embedded assets:
go install github.com/go-bindata/go-bindata/...@latest
go-bindata -o binaries/bindata.go -pkg binaries ./binaries/...Or use the PowerShell script:
.\update-binaries.ps1# Build version 4.3ga10
make X3270_VERSION=4.3ga10 deepclean all
# Verify the version
./binaries/linux/s3270 -v# On Linux, build for both platforms
make all
# Verify Linux binaries
ls -lh binaries/linux/
# Verify Windows binaries
ls -lh binaries/windows/# In CI pipeline
make X3270_VERSION=4.4ga6 all
make test-binaries- The build directory (
/tmp/x3270-build) is preserved between builds for faster subsequent builds - Use
make cleanto remove binaries without removing the source - Use
make deepcleanto remove everything and start fresh - The Makefile uses color output for better visibility of build steps
- Parallel compilation is enabled by default using all available CPU cores
This Makefile is part of the 3270Connect project and follows the same license (MIT).