aboutsummaryrefslogtreecommitdiffstats
path: root/src/Makefile
blob: b2346a7b682ac7b9af6c63e782474df5a6b46bff (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#
# Copyright (c) 2020-2022, yzrh <yzrh@noema.org>
#
# SPDX-License-Identifier: Apache-2.0
#

src =	melon.c iconv.c zlib.c jbig2.c jpeg.c jp2.c md5.c \
	cnki_caj.c cnki_hn.c cnki_kdh.c cnki_outline_tree.c cnki_pdf.c \
	cnki_zlib.c cnki_jbig.c cnki_jbig_dec.c cnki_jbig2.c cnki.c \
	pdf_cnki.c pdf_get.c pdf_parser.c pdf_writer.c pdf.c
inc =	extern.h version.h iconv.h zlib.h jbig2.h jpeg.h jp2.h md5.h \
	cnki.h pdf_cnki.h cnki_jbig.h cnki_jbig_dec.h pdf.h

obj = ${src:.c=.o}

PREFIX = /usr/local

CFLAGS = -O2 -pipe -flto -Wall -Wextra
LDFLAGS = -Wl,-O2 -lcrypto -lz -ljbig2dec -ljpeg -lopenjp2 -Wl,--as-needed

CFLAGS += -I/usr/local/include
LDFLAGS += -L/usr/local/lib

OPENJPEG_CFLAGS != pkgconf --cflags libopenjp2

CFLAGS += ${OPENJPEG_CFLAGS}
CFLAGS += -DLIBICONV_PLUG

all: ${obj} ${inc}
	${CC} ${LDFLAGS} -o melon ${obj}

clean:
	rm -f melon ${obj}

install:
	install -d ${PREFIX}/bin
	install melon ${PREFIX}/bin/

deinstall:
	rm -f ${PREFIX}/bin/melon

.PHONY: all clean install deinstall