Skip to content

Commit

Permalink
Added HIDAPI as submodule
Browse files Browse the repository at this point in the history
- removed unneeded files
- library is now a static part. no dynamic linking
  • Loading branch information
a3f committed Jun 17, 2015
1 parent 22806bd commit 11e9d33
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 513 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "hidapi"]
path = hidapi
url = https://github.com/signal11/hidapi.git
58 changes: 43 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,46 +1,74 @@
##################################################
# Cross-Platform Makefile for the ev3duder utility
#
# Ahmad Fatoum
# Hochschule Aschaffenburg
# 2015-06-17
##################################################

BIN_NAME = ev3duder
# ^ exe should be removed
# CC = gcc
# tip: clang -Weverything shows all GNU extensions
override FLAGS += -std=c99 -Wall -Wextra

FLAGS += -std=c99 -Wall -Wextra
SRCDIR = src
OBJDIR = build

#LIBS = -lpsapi

SRCS = src/main.c src/cmd_defaults.c src/run.c src/test.c src/up.c src/ls.c src/rm.c src/mkdir.c src/mkrbf.c src/dl.c

# TODO: Apple's ld doesn't support interleaving -Bstatic
LIBS = -Llib/ -lhidapi
INC += -Iinclude/
INC += -Ihidapi/hidapi/

print-% : ; @echo $* = $($*)
####################
ifeq ($(OS),Windows_NT)

## MinGW
ifneq ($(shell uname -o),Cygwin)
RM = del /Q
FLAGS += -municode
endif

## Win32
# TODO: remove all %zu prints altogether
FLAGS += -municode -Wno-unused-value -D__USE_MINGW_ANSI_STDIO=1
SRCS += src/btwin.c
HIDSRC += hidapi/windows/hid.c
HIDFLAGS += -mwindows -lsetupapi
BIN_NAME := $(addsuffix .exe, $(BIN_NAME))
VOID = NUL
else

UNAME = $(shell uname -s)
## Linux
ifeq ($(UNAME),Linux)
HIDSRC += hidapi/linux/hid.c
endif

## OS X
ifeq ($(UNAME),Darwin)
HIDSRC += hidapi/mac/hid.c
endif

## ALL UNICES
SRCS += src/btunix.c
VOID = /dev/null
endif
OBJS = $(SRCS:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
OBJS = $(SRCS:$(SRCDIR)/%.c=$(OBJDIR)/%.o)

.DEFAULT: all
all: binary

binary: $(OBJS)
$(CC) $(OBJS) $(FLAGS) $(LIBS) -o $(BIN_NAME)
binary: $(OBJS) $(OBJDIR)/hid.o
-@mkdir build || true
$(CC) $(OBJS) $(OBJDIR)/hid.o $(FLAGS) $(HIDFLAGS) $(LIBS) -o $(BIN_NAME)
# static enables valgrind to act better -DDEBUG!
$(OBJS): $(OBJDIR)/%.o: $(SRCDIR)/%.c
$(CC) -c $< -MMD $(FLAGS) $(INC) -o $@
-include $(OBJDIR)/*.d

$(OBJDIR)/hid.o: $(HIDSRC)
$(CC) -c $< -o $@ $(INC)


# CC=/path/to/cross/cc will need to be passed to make
# TODO: remove all %zu prints altogether
win32: FLAGS += -municode -Wno-unused-value -D__USE_MINGW_ANSI_STDIO=1
win32: all

debug: FLAGS += -g
debug: LIBS := $(LIBS)
Expand Down
87 changes: 0 additions & 87 deletions arm.rbf

This file was deleted.

Binary file removed bitte.rbf
Binary file not shown.
Binary file removed ev3duder.zip
Binary file not shown.
1 change: 1 addition & 0 deletions hidapi
Submodule hidapi added at d17db5
Loading

0 comments on commit 11e9d33

Please sign in to comment.