mirror of
https://github.com/mii443/libdatachannel.git
synced 2025-08-22 23:25:33 +00:00
Enhanced Makefile
This commit is contained in:
28
Makefile
28
Makefile
@ -1,16 +1,17 @@
|
|||||||
|
# libdatachannel
|
||||||
|
|
||||||
NAME=libdatachannel
|
NAME=libdatachannel
|
||||||
CXX=$(CROSS)g++
|
CXX=$(CROSS)g++
|
||||||
AR=$(CROSS)ar
|
AR=$(CROSS)ar
|
||||||
RM=rm -f
|
RM=rm -f
|
||||||
CPPFLAGS=-pthread -std=c++17 -fPIC -Wall -Wno-reorder -Wno-sign-compare -Wno-unused-function -Og -g
|
CPPFLAGS=-O2 -pthread -fPIC -Wall -Wno-address-of-packed-member
|
||||||
|
CXXFLAGS=-std=c++17
|
||||||
LDFLAGS=-pthread
|
LDFLAGS=-pthread
|
||||||
LDLIBS=$(shell pkg-config --libs glib-2.0 gobject-2.0 nice) -lgnutls
|
LDLIBS=$(shell pkg-config --libs glib-2.0 gobject-2.0 nice) -lgnutls
|
||||||
INCLUDES=$(shell pkg-config --cflags glib-2.0 gobject-2.0 nice) -I$(USRSCTP_DIR)/usrsctplib
|
INCLUDES=$(shell pkg-config --cflags glib-2.0 gobject-2.0 nice) -I$(USRSCTP_DIR)/usrsctplib
|
||||||
|
|
||||||
USRSCTP_DIR:=usrsctp
|
USRSCTP_DIR:=usrsctp
|
||||||
USRSCTP_DEFINES:=-DINET -DINET6
|
USRSCTP_DEFINES:=-DINET -DINET6
|
||||||
USRSCTP_CFLAGS:=-fPIC -Wno-address-of-packed-member
|
|
||||||
|
|
||||||
SRCS=$(shell printf "%s " src/*.cpp)
|
SRCS=$(shell printf "%s " src/*.cpp)
|
||||||
OBJS=$(subst .cpp,.o,$(SRCS))
|
OBJS=$(subst .cpp,.o,$(SRCS))
|
||||||
@ -18,10 +19,10 @@ OBJS=$(subst .cpp,.o,$(SRCS))
|
|||||||
all: $(NAME).a $(NAME).so tests
|
all: $(NAME).a $(NAME).so tests
|
||||||
|
|
||||||
src/%.o: src/%.cpp
|
src/%.o: src/%.cpp
|
||||||
$(CXX) $(CPPFLAGS) $(INCLUDES) $(USRSCTP_DEFINES) -MMD -MP -o $@ -c $<
|
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(INCLUDES) $(USRSCTP_DEFINES) -MMD -MP -o $@ -c $<
|
||||||
|
|
||||||
test/%.o: test/%.cpp
|
test/%.o: test/%.cpp
|
||||||
$(CXX) $(CPPFLAGS) -Isrc -MMD -MP -o $@ -c $<
|
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -Isrc -MMD -MP -o $@ -c $<
|
||||||
|
|
||||||
-include $(subst .o,.d,$(OBJS))
|
-include $(subst .o,.d,$(OBJS))
|
||||||
|
|
||||||
@ -35,15 +36,22 @@ tests: $(NAME).a test/main.o
|
|||||||
$(CXX) $(LDFLAGS) -o $@ test/main.o $(LDLIBS) $(NAME).a libusrsctp.a
|
$(CXX) $(LDFLAGS) -o $@ test/main.o $(LDLIBS) $(NAME).a libusrsctp.a
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) src/*.o src/*.d
|
-$(RM) src/*.o src/*.d
|
||||||
|
-$(RM) test/*.o test/*.d
|
||||||
|
|
||||||
dist-clean: clean
|
dist-clean: clean
|
||||||
$(RM) $(NAME).a
|
-$(RM) $(NAME).a
|
||||||
$(RM) $(NAME).so
|
-$(RM) $(NAME).so
|
||||||
$(RM) libusrsctp.a
|
-$(RM) libusrsctp.a
|
||||||
$(RM) src/*~
|
-$(RM) tests
|
||||||
|
-$(RM) src/*~
|
||||||
|
-$(RM) test/*~
|
||||||
|
-cd $(USRSCTP_DIR) && make clean
|
||||||
|
|
||||||
libusrsctp.a:
|
libusrsctp.a:
|
||||||
cd $(USRSCTP_DIR) && ./bootstrap && CFLAGS="$(USRSCTP_CFLAGS)" ./configure --enable-static && make
|
cd $(USRSCTP_DIR) && \
|
||||||
|
./bootstrap && \
|
||||||
|
./configure --enable-static --disable-debug CFLAGS="$(CPPFLAGS)" && \
|
||||||
|
$(MAKE)
|
||||||
cp $(USRSCTP_DIR)/usrsctplib/.libs/libusrsctp.a .
|
cp $(USRSCTP_DIR)/usrsctplib/.libs/libusrsctp.a .
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user