-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (61 loc) · 1.62 KB
/
Makefile
File metadata and controls
70 lines (61 loc) · 1.62 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Variables
CC = gcc
CFLAGS = -I./include -Wall
LDFLAGS = -lz -lpng # Common dependencies for libhpdf
LIBNAME = libhpdf.a
PREFIX = /usr/local
# List of object files (matching the .c files in your src directory)
OBJS = src/hpdf_image_png.o \
src/hpdf_image_ccitt.o \
src/hpdf_doc_png.o \
src/hpdf_ext_gstate.o \
src/hpdf_3dmeasure.o \
src/hpdf_exdata.o \
src/hpdf_namedict.o \
src/hpdf_u3d.o
# List of demo executables
PROGRAMS = \
demo/encoding_list.exe \
demo/font_demo.exe \
demo/text_demo.exe \
demo/text_demo2.exe \
demo/image_demo.exe \
demo/jpeg_demo.exe \
demo/jpfont_demo.exe \
demo/line_demo.exe \
demo/link_annotation.exe \
demo/outline_demo.exe \
demo/png_demo.exe \
demo/text_annotation.exe \
demo/ttfont_demo.exe \
demo/character_map.exe \
demo/grid_sheet.exe \
demo/arc_demo.exe \
demo/raw_image_demo.exe \
demo/encryption.exe \
demo/permission.exe \
demo/slide_show_demo.exe \
demo/ext_gstate_demo.exe
# Default target
all: $(LIBNAME)
# Rule to create the static library
$(LIBNAME): $(OBJS)
ar rc $(LIBNAME) $(OBJS)
ranlib $(LIBNAME)
# Pattern rule to compile .c files into .o files
src/%.o: src/%.c
$(CC) $(CFLAGS) -c $< -o $@
# Rule to build demo programs (linking against the library)
demo: $(LIBNAME) $(PROGRAMS)
demo/%.exe: demo/%.c
$(CC) $(CFLAGS) $< -o $@ -L. -lhpdf $(LDFLAGS)
# Cleanup
clean:
rm -f src/*.o ./*.a demo/*.exe
# Installation
install: all
if [ ! -d $(PREFIX)/include ]; then mkdir -p $(PREFIX)/include; fi
if [ ! -d $(PREFIX)/lib ]; then mkdir -p $(PREFIX)/lib; fi
cp include/hpdf*.h $(PREFIX)/include/
chmod 644 $(PREFIX)/include/hpdf*.h
cp -p $(LIBNAME) $(PREFIX)/lib/