1########################################### 2# Simple Makefile for HIDAPI test program 3# 4# Alan Ott 5# Signal 11 Software 6# 2010-06-01 7########################################### 8 9all: hidtest libs 10 11libs: libhidapi.so 12 13CC ?= cc 14CFLAGS ?= -Wall -g -fPIC 15 16CXX ?= c++ 17CXXFLAGS ?= -Wall -g 18 19COBJS = hid.o 20CPPOBJS = ../hidtest/hidtest.o 21OBJS = $(COBJS) $(CPPOBJS) 22INCLUDES = -I../hidapi -I/usr/local/include 23LDFLAGS = -L/usr/local/lib 24LIBS = -lusb -liconv -pthread 25 26 27# Console Test Program 28hidtest: $(OBJS) 29 $(CXX) $(CXXFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS) 30 31# Shared Libs 32libhidapi.so: $(COBJS) 33 $(CC) $(LDFLAGS) -shared -Wl,-soname,$@.0 $^ -o $@ $(LIBS) 34 35# Objects 36$(COBJS): %.o: %.c 37 $(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@ 38 39$(CPPOBJS): %.o: %.cpp 40 $(CXX) $(CXXFLAGS) -c $(INCLUDES) $< -o $@ 41 42 43clean: 44 rm -f $(OBJS) hidtest libhidapi.so ../hidtest/hidtest.o 45 46.PHONY: clean libs 47