Skip to content

Instantly share code, notes, and snippets.

@fearoffish
Created March 29, 2016 20:25
Show Gist options
  • Save fearoffish/1fa6e3a1d079605c092e761e54e21948 to your computer and use it in GitHub Desktop.
Save fearoffish/1fa6e3a1d079605c092e761e54e21948 to your computer and use it in GitHub Desktop.
My Makefile to get openzwave-control-panel working
#
# Makefile for OpenzWave Control Panel application
# Greg Satz
# GNU make only
.SUFFIXES: .cpp .o .a .s
CC := $(CROSS_COMPILE)gcc
CXX := $(CROSS_COMPILE)g++
LD := $(CROSS_COMPILE)g++
AR := $(CROSS_COMPILE)ar rc
RANLIB := $(CROSS_COMPILE)ranlib
DEBUG_CFLAGS := -Wall -Wno-unknown-pragmas -Wno-inline -Wno-format -g -DDEBUG -ggdb -O0
RELEASE_CFLAGS := -Wall -Wno-unknown-pragmas -Wno-format -O3 -DNDEBUG
DEBUG_LDFLAGS := -g
# Change for DEBUG or RELEASE
CFLAGS := -c $(DEBUG_CFLAGS)
LDFLAGS := $(DEBUG_LDFLAGS)
OPENZWAVE := /home/pi/src/python-openzwave/openzwave
LIBMICROHTTPD := /usr/local/lib/libmicrohttpd.a
INCLUDES := -I $(OPENZWAVE)/cpp/src -I $(OPENZWAVE)/cpp/src/command_classes/ \
-I $(OPENZWAVE)/cpp/src/value_classes/ -I $(OPENZWAVE)/cpp/src/platform/ \
-I $(OPENZWAVE)/cpp/src/platform/unix -I $(OPENZWAVE)/cpp/tinyxml/ \
-I /home/pi/src/libmicrohttpd/src/include
# Remove comment below for gnutls support
GNUTLS := -lgnutls
# for Linux uncomment out next three lines
LIBZWAVE := $(OPENZWAVE)/libopenzwave.a
LIBUSB := -ludev
LIBS := $(LIBZWAVE) $(GNUTLS) $(LIBMICROHTTPD) -pthread $(LIBUSB)
# for Mac OS X comment out above 2 lines and uncomment next 5 lines
#ARCH := -arch i386 -arch x86_64
#CFLAGS += $(ARCH)
#LIBZWAVE := $(wildcard $(OPENZWAVE)/cpp/lib/mac/*.a)
#LIBUSB := -framework IOKit -framework CoreFoundation
#LIBS := $(LIBZWAVE) $(GNUTLS) $(LIBMICROHTTPD) -pthread $(LIBUSB) $(ARCH)
%.o : %.cpp
$(CXX) $(CFLAGS) $(INCLUDES) -o $@ $<
%.o : %.c
$(CC) $(CFLAGS) $(INCLUDES) -o $@ $<
all: defs ozwcp
defs:
ifeq ($(LIBZWAVE),)
@echo Please edit the Makefile to avoid this error message.
@exit 1
endif
ozwcp.o: ozwcp.h webserver.h $(OPENZWAVE)/cpp/src/Options.h $(OPENZWAVE)/cpp/src/Manager.h \
$(OPENZWAVE)/cpp/src/Node.h $(OPENZWAVE)/cpp/src/Group.h \
$(OPENZWAVE)/cpp/src/Notification.h $(OPENZWAVE)/cpp/src/platform/Log.h
webserver.o: webserver.h ozwcp.h $(OPENZWAVE)/cpp/src/Options.h $(OPENZWAVE)/cpp/src/Manager.h \
$(OPENZWAVE)/cpp/src/Node.h $(OPENZWAVE)/cpp/src/Group.h \
$(OPENZWAVE)/cpp/src/Notification.h $(OPENZWAVE)/cpp/src/platform/Log.h
ozwcp: ozwcp.o webserver.o zwavelib.o $(LIBZWAVE)
$(LD) -o $@ $(LDFLAGS) ozwcp.o webserver.o zwavelib.o $(LIBS)
dist: ozwcp
rm -f ozwcp.tar.gz
tar -c --exclude=".svn" -hvzf ozwcp.tar.gz ozwcp config/ cp.html cp.js openzwavetinyicon.png README
clean:
rm -f ozwcp *.o
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment