Added Python test, moved the cmd example script to /Test
[usb-relay-hid.git] / commandline / makemake / Makefile
... / ...
CommitLineData
1# Makefile for HID USB relay utility, hidusbrelay-cmd and library
2# for Linux
3# (Quick'n'dirty - no .h dependencies, etc.)
4# Assume make is run in this dir
5# pa04 24-jan-2015
6
7# prototype:
8# Author: Christian Starkjohann
9# Creation Date: 2008-04-11
10# Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH
11
12SRCDIR=..
13VPATH = $(SRCDIR)
14
15CMD_UTILITY := hidusb-relay-cmd
16SHRLIB := usb_relay_device.so
17
18# For Linux: Using old simple version 0.1 of libusb
19HIDDATA := hiddata_libusb01
20USBFLAGS := $(shell libusb-config --cflags)
21USBLIBS := $(shell libusb-config --libs)
22EXE_SUFFIX=
23
24
25# Use the following lines to build for Windows and comment out the 3 above:
26#HIDDATA=hiddata_mswin
27#USBFLAGS=
28#USBLIBS= -lhid -lsetupapi
29#EXE_SUFFIX= .exe
30
31#+pa GCC on my ubuntu 12 won't pick this dir by default ?!
32#USBFLAGS+=-I/usr/include
33
34SRCS = usbrelay-cmd $(HIDDATA)
35
36PROGRAM= $(CMD_UTILITY)$(EXE_SUFFIX)
37
38CC= gcc
39DEBUGFLAGS=
40CFLAGS= -O -Wall $(USBFLAGS) $(DEBUGFLAGS) -I$(SRCDIR)
41LIBS= $(USBLIBS)
42OBJ= $(addsuffix .o,$(SRCS))
43
44all: $(PROGRAM)
45
46$(PROGRAM): $(OBJ)
47 $(CC) -o $(PROGRAM) $(OBJ) $(LIBS)
48
49strip: $(PROGRAM)
50 strip $(PROGRAM)
51
52clean:
53 rm -f *.o $(PROGRAM) $(SHRLIB)
54
55%.c.o:
56 $(CC) $(ARCH_COMPILE) $(CFLAGS) -c $*.c -o $*.o
57
58#
59# Shared library
60# The main lib source is in lib/ and hiddata src with the cmd utility - reorg!
61#
62SRCS_LIB = $(HIDDATA) usb_relay_lib
63CFLAGS += -I../../lib
64VPATH =../../lib:..
65
66$(SHRLIB): $(addsuffix .o, $(SRCS_LIB))
67 $(CC) -shared -Wl,-shared $(addsuffix .o, $(SRCS_LIB)) $(LIBS) -o $(SHRLIB)
68