2018-05-22 23:21:30 +00:00
|
|
|
TARGET = spnav
|
2018-05-22 23:50:41 +00:00
|
|
|
TARGET_LIB = libspnavhdi.so # target lib
|
2018-05-23 00:40:38 +00:00
|
|
|
|
2018-05-22 23:21:30 +00:00
|
|
|
CC = gcc
|
2018-05-23 12:42:09 +00:00
|
|
|
#CFLAGS = -Wall -Wextra -fPIC -pedantic -O2 # C flags for building library
|
|
|
|
CFLAGS = -Wall -Wextra -pedantic -g # C flags for developpement
|
2018-05-23 00:40:38 +00:00
|
|
|
|
|
|
|
LDFLAGS = -Wall -Wextra -O2
|
|
|
|
|
|
|
|
LIBS = -Llib -lhidapi-libusb
|
2018-05-22 23:50:41 +00:00
|
|
|
RM = rm -f # rm command
|
2018-05-22 23:21:30 +00:00
|
|
|
|
2018-05-22 23:50:41 +00:00
|
|
|
.PHONY: all default
|
2018-05-22 23:21:30 +00:00
|
|
|
|
|
|
|
default: $(TARGET)
|
|
|
|
all: default
|
|
|
|
|
|
|
|
OBJECTS = $(patsubst %.c, %.o, $(wildcard *.c))
|
|
|
|
HEADERS = $(wildcard *.h)
|
|
|
|
|
|
|
|
%.o: %.c $(HEADERS)
|
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
.PRECIOUS: $(TARGET) $(OBJECTS)
|
|
|
|
|
|
|
|
$(TARGET): $(OBJECTS)
|
2018-05-23 00:40:38 +00:00
|
|
|
$(CC) $(OBJECTS) -Wall -o $@ $(LIBS)
|
2018-05-22 23:21:30 +00:00
|
|
|
|
2018-05-23 00:40:38 +00:00
|
|
|
# Shared Libs
|
2018-05-22 23:50:41 +00:00
|
|
|
$(TARGET_LIB): $(OBJECTS)
|
2018-05-23 00:40:38 +00:00
|
|
|
$(CC) $(LDFLAGS) -shared -fpic -Wl,--no-undefined -o $@ $^ $(LIBS)
|
2018-05-22 23:21:30 +00:00
|
|
|
|
2018-05-22 23:50:41 +00:00
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
-${RM} ${TARGET}
|
|
|
|
-${RM} ${TARGET_LIB} ${OBJECTS} $(SRCS:.c=.d)
|