Packages

Reads the game controllers attached to the machine and hands their events to any process.

Current section

Files

Jump to
gamepad Makefile
Raw

Makefile

UNAME_S := $(shell uname -s)
PRIV_DIR = priv
HELPER = $(PRIV_DIR)/gamepad_helper
HELPER_SRC = c_src/gamepad_helper.swift

TARGETS =
ifeq ($(UNAME_S),Darwin)
ifneq ($(shell command -v swiftc 2>/dev/null),)
	TARGETS += $(HELPER)
endif
endif

all: $(TARGETS)

$(PRIV_DIR):
	mkdir -p $(PRIV_DIR)

$(HELPER): $(HELPER_SRC) | $(PRIV_DIR)
	swiftc -O -o $@.tmp $< -framework GameController && mv -f $@.tmp $@

clean:
	rm -f $(HELPER) $(PRIV_DIR)/*.tmp

.PHONY: all clean