Commit 2da68737 authored by Ray Bellis's avatar Ray Bellis

use standard Makefile on macOS

parent 23f769e9
......@@ -27,6 +27,11 @@ endif
BUILD_DATE_TIME = $(shell date +%Y%m%d.%k%M%S | sed s/\ //g)
VERSION_INFO = version.h
PKG_CONFIG := $(shell which pkg-config 2>/dev/null)
ifeq ($(PKG_CONFIG),)
ERROR := $(error "pkg-config utility not found")
endif
COMMON_OBJECTS=byte_utils.o database.o minipro.o fuses.o easyconfig.o
OBJECTS=$(COMMON_OBJECTS) main.o minipro-query-db.o
PROGS=minipro minipro-query-db
......@@ -40,8 +45,8 @@ DIST_DIR = $(MINIPRO)-$(VERSION)
BIN_INSTDIR=$(DESTDIR)$(PREFIX)/bin
MAN_INSTDIR=$(DESTDIR)$(PREFIX)/share/man/man1
libusb_CFLAGS = $(shell pkg-config --cflags libusb-1.0)
libusb_LIBS = $(shell pkg-config --libs libusb-1.0)
libusb_CFLAGS := $(shell $(PKG_CONFIG) --cflags libusb-1.0)
libusb_LIBS := $(shell $(PKG_CONFIG) --libs libusb-1.0)
CFLAGS = -g -O0
override CFLAGS += $(libusb_CFLAGS)
......
#
# minipro Makefile for macOS (tested with macOS High Sierra)
# by Maciej Bartosiak, updated by Ray Bellis
#
# This Makefile assumes than libusb-1.0.x is installed and findable via pkg-config
#
VERSION = 0.1
CC = clang
HEADERS = byte_utils.h database.h devices.h easyconfig.h error.h fuses.h main.h minipro.h
COMMON_OBJECTS = byte_utils.o database.o easyconfig.o fuses.o minipro.o
OBJECTS = $(COMMON_OBJECTS) main.o minipro-query-db.o
MINIPRO = minipro
MINIPRO_QUERY_DB= minipro-query-db
PROGS = $(MINIPRO) $(MINIPRO_QUERY_DB)
PKG_CONFIG := $(shell which pkg-config 2>/dev/null)
ifeq ($(PKG_CONFIG),)
ERROR := $(error "pkg-config utility not found")
endif
CFLAGS = -g -O0 -Wall $(shell $(PKG_CONFIG) --cflags libusb-1.0)
LIBS = $(shell $(PKG_CONFIG) --libs libusb-1.0) -framework Foundation -framework IOKit
.PHONY: all clean install
all: version $(PROGS)
version:
@echo "#define VERSION \"$(VERSION)\"" > version.h
$(MINIPRO): $(HEADERS) $(COMMON_OBJECTS) main.o
$(CC) -o $(MINIPRO) $(COMMON_OBJECTS) main.o $(LIBS) $(LDFLAGS)
$(MINIPRO_QUERY_DB): $(HEADERS) $(COMMON_OBJECTS) minipro-query-db.o
$(CC) -o $(MINIPRO_QUERY_DB) $(COMMON_OBJECTS) minipro-query-db.o $(LIBS) $(LDFLAGS)
clean:
rm -f $(OBJECTS) $(PROGS)
INSTALL_DIR = /usr/local
INSTALL_BIN_DIR = $(INSTALL_DIR)/bin
INSTALL_MAN_DIR = $(INSTALL_DIR)/share/man/man1
install: all $(INSTALL_DIR) $(INSTALL_BIN_DIR) $(INSTALL_MAN_DIR)
cp $(MINIPRO) $(INSTALL_BIN_DIR)/
cp $(MINIPRO_QUERY_DB) $(INSTALL_BIN_DIR)/
cp man/minipro.1 $(INSTALL_MAN_DIR)
uninstall:
rm -f $(INSTALL_BIN_DIR)/$(MINIPRO)
rm -f $(INSTALL_BIN_DIR)/$(MINIPRO_QUERY_DB)
rm -f $(INSTALL_MAN_DIR)/minipro.1
$(INSTALL_DIR):
mkdir -p $(INSTALL_DIR)
$(INSTALL_BIN_DIR):
mkdir -p $(INSTALL_BIN_DIR)
$(INSTALL_MAN_DIR):
mkdir -p $(INSTALL_MAN_DIR)
......@@ -122,6 +122,7 @@ The final RPMs can be found below `~/rpmbuild/RPMS/`
## Installation on macOS
### Install dependencies
Install `pkg-config` and `libusb` using brew or MacPorts:
```
brew install pkg-config
......@@ -133,9 +134,10 @@ or:
port install pkgconfig
port install libusb
```
Compile using macOS Makefile:
```
make -f Makefile.macOS
sudo make -f Makefile.macOS install
### Checkout source code and compile
```nohighlight
git clone https://github.com/vdudouyt/minipro.git
cd minipro
make
sudo make install
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment