Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
77 lines (63 sloc) 2.43 KB
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# <> wrote this file. As long as you retain this notice
# you can do whatever you want with this stuff. If we meet some day, and you
# think this stuff is worth it, you can buy me a beer in return. Thomas Buck
# ----------------------------------------------------------------------------
# C Compiler flags for command line apps
CFLAGS ?= -Wall -pedantic -std=c11
# Targets that don't name any created files
.PHONY: all install distribute clean
# Build all binaries
all: bin/protocol bin/foohid build/Release/
@rm -rf bin/
@cp -R build/Release/ bin/
# Install locally
install: bin/protocol bin/foohid build/Release/
cp bin/protocol /usr/local/bin/serial-protocol
cp bin/foohid /usr/local/bin/foohid
@rm -rf /Applications/
cp -r build/Release/ /Applications/
# Build GUI project
build/Release/ SerialGamepad SerialGamepad.xcodeproj
# Build protocol binary
bin/protocol: src/serial.o src/protocol.o
@mkdir -p bin
$(CC) -o bin/protocol src/serial.o src/protocol.o
# Build foohid binary
bin/foohid: src/serial.o src/foohid.o
@mkdir -p bin
$(CC) -o bin/foohid -framework IOKit src/serial.o src/foohid.o
# Build distributable installer package
distribute: build/Installer.pkg
@mkdir -p bin
@rm -rf bin/SerialGamepad.pkg
@cp -R build/Installer.pkg bin/SerialGamepad.pkg
# Download foohid binary dependency
@mkdir -p build
curl -o build/foohid.dmg \
hdiutil attach build/foohid.dmg
cp /Volumes/foohid/foohid-0.2.1.pkg build/foohid.pkg
umount /Volumes/foohid
# Create installer pkg for our App
build/SerialGamepad.pkg: build/Release/
pkgbuild \
--root build/Release/ \
--identifier de.xythobuz.SerialGamepad \
--install-location "/Applications/" \
# Create installer bundling our App and fooHID
build/Installer.pkg: build/SerialGamepad.pkg build/foohid.pkg Resources
productbuild \
--distribution Resources/Distribution.xml \
--package-path build \
--resources Resources \
# Delete intermediate files
rm -rf bin
rm -rf build
rm -rf src/*.o