Merge pull request #14 from zbeekman/master
Improve build/install experience on macOS
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
SHELL = /bin/bash
|
||||
|
||||
GIT_VERSION := $(shell git --no-pager describe --tags --always)
|
||||
GIT_COMMIT := $(shell git rev-parse --verify HEAD)
|
||||
GIT_DATE := $(firstword $(shell git --no-pager show --date=iso-strict --format="%ad" --name-only))
|
||||
@@ -6,9 +8,9 @@ PREFIX = $(DESTDIR)/usr/local
|
||||
|
||||
# Against 'libftdi0' from MacOS X ports or brew
|
||||
#
|
||||
FTDILOCI = /opt/local/include
|
||||
FTDILOCL = /opt/local/lib
|
||||
FTDI= -lftdi
|
||||
FTDILOCI = $(shell brew --prefix libftdi || echo /opt/local)/include/libftdi1
|
||||
FTDILOCL = $(shell brew --prefix libftdi || echo /opt/local)/lib
|
||||
FTDI= -lftdi1
|
||||
|
||||
CFLAGS = -Wall -Wextra -Werror -std=c99 -O3 -fPIC -I Keccak -I $(FTDILOCI) \
|
||||
-DGIT_VERSION=\"$(GIT_VERSION)\"\
|
||||
@@ -17,7 +19,7 @@ CFLAGS = -Wall -Wextra -Werror -std=c99 -O3 -fPIC -I Keccak -I $(FTDILOCI) \
|
||||
|
||||
RM=rm
|
||||
|
||||
all: libinfnoise.a libinfnoise.so infnoise
|
||||
all: libinfnoise.a libinfnoise.so infnoise tools.stamp
|
||||
|
||||
infnoise: libinfnoise.a infnoise.o daemon.o
|
||||
$(CC) $(CFLAGS) -o infnoise infnoise.o daemon.o libinfnoise.a $(FTDI) -lm -L. -L $(FTDILOCL)
|
||||
@@ -43,15 +45,19 @@ libinfnoise.so: libinfnoise.o healthcheck.o KeccakF-1600-reference.o
|
||||
|
||||
libs: libinfnoise.a
|
||||
|
||||
tools.stamp:
|
||||
$(MAKE) -C tools all
|
||||
touch tools.stamp
|
||||
|
||||
clean:
|
||||
$(RM) -f infnoise *.o *.a *.gch *.so libinfnoise-example
|
||||
$(RM) -f infnoise *.o *.a *.gch *.so libinfnoise-example tools.stamp
|
||||
$(MAKE) -C tools clean
|
||||
|
||||
install-lib: libinfnoise.so
|
||||
install -d $(PREFIX)/include
|
||||
install -m 0644 libinfnoise.h $(PREFIX)/include
|
||||
install -d $(PREFIX)/lib
|
||||
install -m 0644 libinfnoise.so $(PREFIX)/lib
|
||||
ldconfig $(PREFIX)/lib
|
||||
|
||||
install: infnoise
|
||||
install -d $(PREFIX)/sbin
|
||||
@@ -61,6 +67,6 @@ install: infnoise
|
||||
install -d $(PREFIX)/lib/systemd/system
|
||||
install -m 0644 init_scripts/infnoise.service $(PREFIX)/lib/systemd/system
|
||||
|
||||
postinstall:
|
||||
systemctl restart systemd-udevd
|
||||
systemctl enable infnoise
|
||||
install-tools: install tools.stamp
|
||||
install -d $(PREFIX)/bin
|
||||
install -m 0755 tools/bin2hex tools/dice tools/entcheck tools/findlongest tools/flipbits tools/healthcheck tools/hex2bin tools/passgen $(PREFIX)/bin/
|
||||
@@ -74,7 +74,7 @@ MacOS
|
||||
|
||||
First install the dependencies, most easily done with homebrew:
|
||||
|
||||
$ brew install libftdi-dev libusb-dev
|
||||
$ brew install libftdi libusb
|
||||
|
||||
Adjust the Makefile, if necessary, to point at your ftdi directory:
|
||||
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
CFLAGS=-Wall -Wextra -Werror -std=c99 -O3 -I /usr/include/libftdi1
|
||||
CFLAGS=-Wall -Wextra -Werror -std=c99 -O3 -I $(shell brew --prefix libftdi || echo /usr)/include/libftdi1
|
||||
UNAME_S := $(shell uname -s)
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
LIBRT=
|
||||
else
|
||||
LIBRT=-lrt
|
||||
endif
|
||||
|
||||
all: passgen healthcheck findlongest entcheck hex2bin bin2hex flipbits dice
|
||||
|
||||
@@ -6,10 +12,10 @@ passgen: passgen.c
|
||||
$(CC) $(CFLAGS) -o passgen passgen.c -lm
|
||||
|
||||
healthcheck: ../healthcheck.c
|
||||
$(CC) $(CFLAGS) -D TEST_HEALTHCHECK -o healthcheck ../healthcheck.c -lm -lrt
|
||||
$(CC) $(CFLAGS) -D TEST_HEALTHCHECK -o healthcheck ../healthcheck.c -lm $(LIBRT)
|
||||
|
||||
entcheck: entcheck.c
|
||||
$(CC) $(CFLAGS) -o entcheck entcheck.c -lm -lrt
|
||||
$(CC) $(CFLAGS) -o entcheck entcheck.c -lm $(LIBRT)
|
||||
|
||||
findlongest: findlongest.c
|
||||
$(CC) $(CFLAGS) -o findlongest findlongest.c
|
||||
|
||||
Reference in New Issue
Block a user