2021-07-03 21:57:53 +02:00
|
|
|
|
|
|
|
AR ?= $(CROSS)ar
|
|
|
|
CXX ?= $(CROSS)g++
|
|
|
|
|
2021-08-21 20:57:31 +02:00
|
|
|
UPDFPARSERLIB = ./lib/updfparser/libupdfparser.a
|
|
|
|
|
|
|
|
CXXFLAGS=-Wall -fPIC -I./include -I./lib -I./lib/pugixml/src/ -I./lib/updfparser/include
|
|
|
|
LDFLAGS = $(UPDFPARSERLIB)
|
|
|
|
|
|
|
|
BUILD_STATIC ?= 0
|
|
|
|
BUILD_SHARED ?= 1
|
2021-08-25 21:54:52 +02:00
|
|
|
BUILD_UTILS ?= 1
|
2021-08-21 20:57:31 +02:00
|
|
|
|
|
|
|
TARGETS =
|
2021-08-25 21:54:52 +02:00
|
|
|
ifneq ($(BUILD_STATIC), 0)
|
2021-08-21 20:57:31 +02:00
|
|
|
TARGETS += libgourou.a
|
|
|
|
endif
|
2021-08-25 21:54:52 +02:00
|
|
|
ifneq ($(BUILD_SHARED), 0)
|
2021-08-21 20:57:31 +02:00
|
|
|
TARGETS += libgourou.so
|
|
|
|
endif
|
2021-08-25 21:54:52 +02:00
|
|
|
ifneq ($(BUILD_UTILS), 0)
|
|
|
|
TARGETS += build_utils
|
|
|
|
endif
|
|
|
|
|
2021-07-03 21:57:53 +02:00
|
|
|
|
|
|
|
ifneq ($(DEBUG),)
|
|
|
|
CXXFLAGS += -ggdb -O0
|
|
|
|
else
|
|
|
|
CXXFLAGS += -O2
|
|
|
|
endif
|
|
|
|
|
|
|
|
SRCDIR := src
|
|
|
|
INCDIR := inc
|
|
|
|
BUILDDIR := obj
|
|
|
|
TARGETDIR := bin
|
|
|
|
SRCEXT := cpp
|
|
|
|
OBJEXT := o
|
|
|
|
|
2021-08-21 20:57:31 +02:00
|
|
|
SOURCES = src/libgourou.cpp src/user.cpp src/device.cpp src/fulfillment_item.cpp src/bytearray.cpp src/pugixml.cpp
|
2021-07-03 21:57:53 +02:00
|
|
|
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.$(OBJEXT)))
|
|
|
|
|
2021-08-25 21:54:52 +02:00
|
|
|
all: lib obj $(TARGETS)
|
2021-07-03 21:57:53 +02:00
|
|
|
|
|
|
|
lib:
|
|
|
|
mkdir lib
|
|
|
|
./scripts/setup.sh
|
|
|
|
|
|
|
|
obj:
|
|
|
|
mkdir obj
|
|
|
|
|
|
|
|
$(BUILDDIR)/%.$(OBJEXT): $(SRCDIR)/%.$(SRCEXT)
|
|
|
|
$(CXX) $(CXXFLAGS) -c $^ -o $@
|
|
|
|
|
|
|
|
libgourou: libgourou.a libgourou.so
|
|
|
|
|
|
|
|
libgourou.a: $(OBJECTS)
|
2021-08-21 20:57:31 +02:00
|
|
|
$(AR) crs $@ obj/*.o $(LDFLAGS)
|
2021-07-03 21:57:53 +02:00
|
|
|
|
2021-08-21 20:57:31 +02:00
|
|
|
libgourou.so: $(OBJECTS) $(UPDFPARSERLIB)
|
2021-07-03 21:57:53 +02:00
|
|
|
$(CXX) obj/*.o $(LDFLAGS) -o $@ -shared
|
|
|
|
|
2021-08-25 21:54:52 +02:00
|
|
|
build_utils:
|
2021-07-05 20:23:25 +02:00
|
|
|
make -C utils ROOT=$(PWD) CXX=$(CXX) AR=$(AR) DEBUG=$(DEBUG) STATIC_UTILS=$(STATIC_UTILS)
|
2021-07-03 21:57:53 +02:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf libgourou.a libgourou.so obj
|
|
|
|
make -C utils clean
|
|
|
|
|
|
|
|
ultraclean: clean
|
|
|
|
rm -rf lib
|
|
|
|
make -C utils ultraclean
|