Skip to content

Commit

Permalink
Fix manual Makefiles and add CI for them (libusb#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
z3ntu authored and Youw committed Jan 12, 2020
1 parent 65d22a9 commit 51bdec7
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 44 deletions.
6 changes: 6 additions & 0 deletions .builds/alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,9 @@ tasks:
cd hidapi
make
make DESTDIR=$PWD/root install
make clean
- build-manual: |
cd hidapi/linux
make -f Makefile-manual
cd ../libusb
make -f Makefile-manual
6 changes: 6 additions & 0 deletions .builds/archlinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ tasks:
cd hidapi
make
make DESTDIR=$PWD/root install
make clean
- build-manual: |
cd hidapi/linux
make -f Makefile-manual
cd ../libusb
make -f Makefile-manual
4 changes: 4 additions & 0 deletions .builds/fedora-mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ tasks:
cd hidapi
make
make DESTDIR=$PWD/root install
make clean
- build-manual: |
cd hidapi/windows
make -f Makefile-manual OS=MINGW CC=x86_64-w64-mingw32-gcc
5 changes: 5 additions & 0 deletions .builds/freebsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ image: freebsd/latest
packages:
- autoconf
- automake
- gmake
- libiconv
- libtool
- pkgconf
Expand All @@ -16,3 +17,7 @@ tasks:
cd hidapi
make
make DESTDIR=$PWD/root install
make clean
- build-manual: |
cd hidapi/libusb
gmake -f Makefile-manual
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ script:
- ./configure
- make
- make DESTDIR=$PWD/root install
- make clean
- cd mac
- make -f Makefile-manual
13 changes: 3 additions & 10 deletions libusb/Makefile.freebsd
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,16 @@ libs: libhidapi.so
CC ?= cc
CFLAGS ?= -Wall -g -fPIC

CXX ?= c++
CXXFLAGS ?= -Wall -g

COBJS = hid.o
CPPOBJS = ../hidtest/hidtest.o
OBJS = $(COBJS) $(CPPOBJS)
COBJS = hid.o ../hidtest/test.o
OBJS = $(COBJS)
INCLUDES = -I../hidapi -I/usr/local/include
LDFLAGS = -L/usr/local/lib
LIBS = -lusb -liconv -pthread


# Console Test Program
hidtest: $(OBJS)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS)
$(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS)

# Shared Libs
libhidapi.so: $(COBJS)
Expand All @@ -36,9 +32,6 @@ libhidapi.so: $(COBJS)
$(COBJS): %.o: %.c
$(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@

$(CPPOBJS): %.o: %.cpp
$(CXX) $(CXXFLAGS) -c $(INCLUDES) $< -o $@


clean:
rm -f $(OBJS) hidtest libhidapi.so ../hidtest/hidtest.o
Expand Down
15 changes: 4 additions & 11 deletions libusb/Makefile.linux
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,19 @@ libs: libhidapi-libusb.so
CC ?= gcc
CFLAGS ?= -Wall -g -fpic

CXX ?= g++
CXXFLAGS ?= -Wall -g -fpic

LDFLAGS ?= -Wall -g

COBJS_LIBUSB = hid.o
COBJS = $(COBJS_LIBUSB)
CPPOBJS = ../hidtest/hidtest.o
OBJS = $(COBJS) $(CPPOBJS)
COBJS = $(COBJS_LIBUSB) ../hidtest/test.o
OBJS = $(COBJS)
LIBS_USB = `pkg-config libusb-1.0 --libs` -lrt -lpthread
LIBS = $(LIBS_USB)
INCLUDES ?= -I../hidapi `pkg-config libusb-1.0 --cflags`


# Console Test Program
hidtest-libusb: $(COBJS_LIBUSB) $(CPPOBJS)
$(CXX) $(LDFLAGS) $^ $(LIBS_USB) -o $@
hidtest-libusb: $(COBJS)
$(CC) $(LDFLAGS) $^ $(LIBS_USB) -o $@

# Shared Libs
libhidapi-libusb.so: $(COBJS_LIBUSB)
Expand All @@ -39,9 +35,6 @@ libhidapi-libusb.so: $(COBJS_LIBUSB)
$(COBJS): %.o: %.c
$(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@

$(CPPOBJS): %.o: %.cpp
$(CXX) $(CXXFLAGS) -c $(INCLUDES) $< -o $@


clean:
rm -f $(OBJS) hidtest-libusb libhidapi-libusb.so ../hidtest/hidtest.o
Expand Down
13 changes: 3 additions & 10 deletions linux/Makefile-manual
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,18 @@ libs: libhidapi-hidraw.so
CC ?= gcc
CFLAGS ?= -Wall -g -fpic

CXX ?= g++
CXXFLAGS ?= -Wall -g -fpic

LDFLAGS ?= -Wall -g


COBJS = hid.o ../hidtest/test.o
CPPOBJS =
OBJS = $(COBJS) $(CPPOBJS)
OBJS = $(COBJS)
LIBS_UDEV = `pkg-config libudev --libs` -lrt
LIBS = $(LIBS_UDEV)
INCLUDES ?= -I../hidapi `pkg-config libusb-1.0 --cflags`


# Console Test Program
hidtest-hidraw: $(COBJS) $(CPPOBJS)
hidtest-hidraw: $(COBJS)
$(CC) $(LDFLAGS) $^ $(LIBS_UDEV) -o $@

# Shared Libs
Expand All @@ -39,11 +35,8 @@ libhidapi-hidraw.so: $(COBJS)
$(COBJS): %.o: %.c
$(CC) $(CFLAGS) -c $(INCLUDES) $< -o $@

$(CPPOBJS): %.o: %.cpp
$(CXX) $(CXXFLAGS) -c $(INCLUDES) $< -o $@


clean:
rm -f $(OBJS) hidtest-hidraw libhidapi-hidraw.so $(COBJS) $(CPPOBJS)
rm -f $(OBJS) hidtest-hidraw libhidapi-hidraw.so $(COBJS)

.PHONY: clean libs
6 changes: 1 addition & 5 deletions mac/Makefile-manual
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
all: hidtest

CC=gcc
CXX=g++
COBJS=hid.o ../hidtest/test.o
OBJS=$(COBJS)
CFLAGS+=-I../hidapi -Wall -g -c
Expand All @@ -22,10 +21,7 @@ hidtest: $(OBJS)
$(COBJS): %.o: %.c
$(CC) $(CFLAGS) $< -o $@

$(CPPOBJS): %.o: %.cpp
$(CXX) $(CFLAGS) $< -o $@

clean:
rm -f *.o hidtest $(CPPOBJS)
rm -f *.o hidtest

.PHONY: clean
11 changes: 3 additions & 8 deletions windows/Makefile.mingw
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,21 @@
all: hidtest libhidapi.dll

CC=gcc
CXX=g++
COBJS=hid.o
CPPOBJS=../hidtest/hidtest.o
OBJS=$(COBJS) $(CPPOBJS)
COBJS=hid.o ../hidtest/test.o
OBJS=$(COBJS)
CFLAGS=-I../hidapi -g -c
LIBS= -lsetupapi
DLL_LDFLAGS = -mwindows -lsetupapi

hidtest: $(OBJS)
g++ -g $^ $(LIBS) -o hidtest
$(CC) -g $^ $(LIBS) -o hidtest

libhidapi.dll: $(OBJS)
$(CC) -g $^ $(DLL_LDFLAGS) -o libhidapi.dll

$(COBJS): %.o: %.c
$(CC) $(CFLAGS) $< -o $@

$(CPPOBJS): %.o: %.cpp
$(CXX) $(CFLAGS) $< -o $@

clean:
rm *.o ../hidtest/*.o hidtest.exe

Expand Down

0 comments on commit 51bdec7

Please sign in to comment.