29 lines
700 B
Makefile
29 lines
700 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 -I/usr/include/libusb-1.0 -lusb-1.0 -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
|