Files
uhubctl/Makefile
Vadim Mikhailov d96308569c uhubctl is in homebrew core now - remove obsolete files, update readme
* remove custom homebrew tap - uhubctl is included in homebrew core now.
* remove bitbake recipe - it does not seem to be used for years now,
  and it should not have been committed in first place.
* add `installing` paragraph to readme. since most relevant OS include uhubctl
  in standard package managers now, most people don't want to compile it,
  but instead know how to install it quickly.
* update short links to not use bit.ly as it became very spammy now.
* update few expired links to point to archive.org cache.
* add `all` target to Makefile (FreeBSD ports want `all` target to always exist).
2025-04-18 23:13:56 -07:00

54 lines
1.2 KiB
Makefile

# uhubctl Makefile
#
UNAME_S := $(shell uname -s)
DESTDIR ?=
prefix ?= /usr
sbindir ?= $(prefix)/sbin
INSTALL := install
INSTALL_DIR := $(INSTALL) -m 755 -d
INSTALL_PROGRAM := $(INSTALL) -m 755
RM := rm -rf
PKG_CONFIG ?= pkg-config
CC ?= gcc
CFLAGS ?= -g -O0
CFLAGS += -Wall -Wextra -Wno-zero-length-array -std=c99 -pedantic
GIT_VERSION := $(shell git describe --match "v[0-9]*" --abbrev=8 --dirty --tags | cut -c2-)
ifeq ($(GIT_VERSION),)
GIT_VERSION := $(shell cat VERSION)
endif
CFLAGS += -DPROGRAM_VERSION=\"$(GIT_VERSION)\"
# Use hardening options on Linux
ifeq ($(UNAME_S),Linux)
LDFLAGS += -Wl,-zrelro,-znow
endif
# Use pkg-config if available
ifneq (,$(shell which $(PKG_CONFIG)))
CFLAGS += $(shell $(PKG_CONFIG) --cflags libusb-1.0)
LDFLAGS += $(shell $(PKG_CONFIG) --libs libusb-1.0)
else
# But it should still build even if pkg-config is not available
CFLAGS += -I/usr/include/libusb-1.0
LDFLAGS += -lusb-1.0
endif
PROGRAM = uhubctl
.PHONY: all install clean
all: $(PROGRAM)
$(PROGRAM): $(PROGRAM).c
$(CC) $(CPPFLAGS) $(CFLAGS) $@.c -o $@ $(LDFLAGS)
install:
$(INSTALL_DIR) $(DESTDIR)$(sbindir)
$(INSTALL_PROGRAM) $(PROGRAM) $(DESTDIR)$(sbindir)
clean:
$(RM) $(PROGRAM).o $(PROGRAM).dSYM $(PROGRAM)