29 lines
681 B
Makefile
29 lines
681 B
Makefile
CC ?= cc
|
|
INSTALL_PATH ?= /usr
|
|
|
|
all: build
|
|
|
|
build: target/mpfm target/mpfm.service
|
|
|
|
target/mpfm: mpfm.c
|
|
mkdir -p target
|
|
$(CC) -std=gnu99 -O2 mpfm.c -lusb-1.0 -ludev -o target/mpfm
|
|
|
|
target/mpfm.service: mpfm.service
|
|
mkdir -p target
|
|
sed -E 's|__INSTALL_PATH__|$(INSTALL_PATH)|g' mpfm.service > target/mpfm.service
|
|
|
|
install: build mpfm.rules
|
|
mkdir -p $(INSTALL_PATH)/{bin,lib/systemd/system}
|
|
install target/mpfm $(INSTALL_PATH)/bin/mpfm
|
|
install target/mpfm.service $(INSTALL_PATH)/lib/systemd/system/mpfm.service
|
|
|
|
uninstall:
|
|
rm -f $(INSTALL_PATH)/lib/systemd/system/mpfm.service
|
|
rm -f $(INSTALL_PATH)/bin/mpfm
|
|
|
|
clean:
|
|
rm -rf target
|
|
|
|
.PHONY: all build clean install uninstall
|