Files
uhubctl/Makefile
Richard Leitner a45cb2a59a Makefile: add cross-compile functionality
Add cross-compile functionality to the Makefile and add an "install"
target. This makes uhubctl "Yocto Project Compatible".

Signed-off-by: Richard Leitner <richard.leitner@skidata.com>
2017-02-20 10:49:30 +01:00

34 lines
569 B
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
CC ?= gcc
CFLAGS ?= -g -O0
CFLAGS += -Wall -Wextra
ifeq ($(UNAME_S),Linux)
LDFLAGS += -Wl,-z,relro
endif
PROGRAM = uhubctl
$(PROGRAM): $(PROGRAM).c
$(CC) $(CFLAGS) $@.c -o $@ -lusb-1.0 $(LDFLAGS)
install:
$(INSTALL_DIR) $(DESTDIR)$(sbindir)
$(INSTALL_PROGRAM) $(PROGRAM) $(DESTDIR)$(sbindir)
clean:
$(RM) $(PROGRAM).o $(PROGRAM).dSYM $(PROGRAM)