Add rule to build shared library in Makefile
Add rule in Makefile to build libspnavhdi.so
This commit is contained in:
parent
c5e8ee585d
commit
b5b56d759c
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1,3 @@
|
|||||||
.vscode/*
|
.vscode/*
|
||||||
|
|
||||||
|
*.o
|
||||||
|
18
Makefile
18
Makefile
@ -1,9 +1,13 @@
|
|||||||
TARGET = spnav
|
TARGET = spnav
|
||||||
|
TARGET_LIB = libspnavhdi.so # target lib
|
||||||
LIBS = -Llib -lhidapi-libusb
|
LIBS = -Llib -lhidapi-libusb
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -Wall -Wextra -pedantic
|
CFLAGS = -Wall -Wextra -fPIC -pedantic -O2 # C flags for building library
|
||||||
|
#CFLAGS = -Wall -Wextra -pedantic -g # C flags for developpement
|
||||||
|
LDFLAGS = $(LIBS) -shared # linking flags
|
||||||
|
RM = rm -f # rm command
|
||||||
|
|
||||||
.PHONY: mrproper all default
|
.PHONY: all default
|
||||||
|
|
||||||
default: $(TARGET)
|
default: $(TARGET)
|
||||||
all: default
|
all: default
|
||||||
@ -19,8 +23,10 @@ HEADERS = $(wildcard *.h)
|
|||||||
$(TARGET): $(OBJECTS)
|
$(TARGET): $(OBJECTS)
|
||||||
$(CC) $(OBJECTS) -Wall $(LIBS) -o $@
|
$(CC) $(OBJECTS) -Wall $(LIBS) -o $@
|
||||||
|
|
||||||
clean:
|
$(TARGET_LIB): $(OBJECTS)
|
||||||
-rm -f *.o
|
$(CC) ${LDFLAGS} -o $@ $^
|
||||||
|
|
||||||
mrproper: clean
|
.PHONY: clean
|
||||||
-rm -f $(TARGET)
|
clean:
|
||||||
|
-${RM} ${TARGET}
|
||||||
|
-${RM} ${TARGET_LIB} ${OBJECTS} $(SRCS:.c=.d)
|
||||||
|
Loading…
Reference in New Issue
Block a user