2021-08-21 18:22:58 +02:00
|
|
|
|
|
|
|
AR ?= $(CROSS)ar
|
|
|
|
CXX ?= $(CROSS)g++
|
|
|
|
|
2023-01-10 20:16:27 +01:00
|
|
|
CXXFLAGS += -Wall -fPIC -I./include
|
2021-08-21 18:22:58 +02:00
|
|
|
LDFLAGS=
|
|
|
|
|
|
|
|
BUILD_STATIC ?= 0
|
|
|
|
BUILD_SHARED ?= 1
|
|
|
|
|
|
|
|
TARGETS =
|
2021-08-25 21:41:06 +02:00
|
|
|
ifneq ($(BUILD_STATIC), 0)
|
2021-08-21 18:22:58 +02:00
|
|
|
TARGETS += libupdfparser.a
|
|
|
|
endif
|
2021-08-25 21:41:06 +02:00
|
|
|
ifneq ($(BUILD_SHARED), 0)
|
2021-08-21 18:22:58 +02:00
|
|
|
TARGETS += libupdfparser.so
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(DEBUG),)
|
|
|
|
CXXFLAGS += -ggdb -O0
|
|
|
|
else
|
|
|
|
CXXFLAGS += -O2
|
|
|
|
endif
|
|
|
|
|
|
|
|
SRCDIR := src
|
|
|
|
INCDIR := inc
|
|
|
|
BUILDDIR := obj
|
|
|
|
TARGETDIR := bin
|
|
|
|
SRCEXT := cpp
|
|
|
|
OBJEXT := o
|
|
|
|
|
|
|
|
SOURCES = src/uPDFParser.cpp src/uPDFTypes.cpp
|
|
|
|
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.$(OBJEXT)))
|
|
|
|
|
|
|
|
all: obj $(TARGETS)
|
|
|
|
|
|
|
|
obj:
|
|
|
|
mkdir obj
|
|
|
|
|
|
|
|
$(BUILDDIR)/%.$(OBJEXT): $(SRCDIR)/%.$(SRCEXT)
|
|
|
|
$(CXX) $(CXXFLAGS) -c $^ -o $@
|
|
|
|
|
|
|
|
libupdfparser.a: $(OBJECTS)
|
2023-08-08 20:06:44 +02:00
|
|
|
$(AR) crs $@ $^
|
2021-08-21 18:22:58 +02:00
|
|
|
|
|
|
|
libupdfparser.so: $(OBJECTS)
|
2023-08-08 20:06:44 +02:00
|
|
|
$(CXX) $^ $(LDFLAGS) -o $@ -shared
|
2021-08-21 18:22:58 +02:00
|
|
|
|
2021-09-09 20:57:10 +02:00
|
|
|
test: tests/test.cpp libupdfparser.a
|
2021-08-21 18:22:58 +02:00
|
|
|
g++ -ggdb -O0 $^ -o $@ -Iinclude libupdfparser.a
|
|
|
|
|
|
|
|
clean:
|
2021-09-09 20:57:10 +02:00
|
|
|
rm -rf libupdfparser.so libupdfparser.a obj test
|