-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
executable file
·136 lines (106 loc) · 2.72 KB
/
makefile
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
##
# Purpose:
# For building chromflock.
#
# NOTES:
# - Please use the makedeb-ubuntu_2204.sh or similar scripts to
# create a deb file for installation.
#
# WARNING:
# Do not use --finite-math-only (or --ffast-math or -Ofast) since
# both aflock and mflock uses isfinite().
CC = gcc -std=gnu99
CFLAGS=-Wall -Wextra
LDFLAGS=
DEBUG?=0
ifeq ($(DEBUG),1)
CFLAGS += -g3 \
-DNOMATLAB \
-fanalyzer \
-pedantic
else
CFLAGS += -O3 \
-DNDEBUG \
-fno-signed-zeros \
-fno-trapping-math \
-fno-math-errno
LDFLAGS += -flto
endif
#
# Inject some information in the binaries
#
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
MANPATH=/usr/local/share/man/man1
endif
CC_VERSION = "$(shell cc --version | head -n 1)"
GIT_VERSION = "$(shell git log --pretty=format:'%aD:%H' -n 1)"
CFLAGS += -DCC_VERSION=\"$(CC_VERSION)\"
CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
#
# Standard libraries
#
LDFLAGS += -lm -lpthread -ldl
# Library: Z
CFLAGS += `pkg-config zlib --cflags`
LDFLAGS += `pkg-config zlib --libs`
# Library: LUA
CFLAGS += -Isrc/lua-5.3.5/src
LDFLAGS += -Lsrc/lua-5.3.5/src -llua
# Library: Cairo
CFLAGS+=`pkg-config cairo --cflags`
LDFLAGS+=`pkg-config cairo --libs`
# Library: SDL2
SDL?=1
ifeq ($(SDL),1)
CFLAGS += `pkg-config sdl2 --cflags`
CFLAGS += -DSDL
LDFLAGS += `pkg-config sdl2 --libs`
endif
all: bin/chromflock \
bin/aflock \
bin/mflock \
chromflock_files=src/chromflock.c \
src/cc2cpm.c \
src/string2any.c \
src/any2string.c \
src/oscp.c \
src/sprite2cmap.c \
obj/chromflock_init.o \
obj/balance.o \
obj/cf_util.o
## Targets
bin/chromflock: $(chromflock_files)
$(CC) $(CFLAGS) $(chromflock_files) $(LDFLAGS) -o bin/chromflock
bin/cmmfilter:
$(CC) $(CFLAGS) `xml2-config --cflags` src/cmmfilter.c `xml2-config --libs` $(LDFLAGS) -o bin/cmmfilter
mflock_files = src/mflock_cli.c \
src/mflock.o \
src/functional.o \
src/cmmwrite.o \
src/wio.o \
src/hsvrgb.o \
src/liveview.o \
obj/ellipsoid.o \
obj/contact_pairs_io.o \
obj/cf_util.o \
bin/mflock: $(mflock_files) makefile
$(CC) $(CFLAGS) $(mflock_files) -o bin/mflock $(LDFLAGS)
aflock_files = src/aflock.c \
src/wio.c \
src/oscp.c \
obj/ellipsoid.o \
obj/cf_util.o \
obj/contact_pairs_io.o
bin/aflock: $(aflock_files) makefile
$(CC) $(CFLAGS) $(aflock_files) -o bin/aflock $(LDFLAGS)
obj/chromflock_init.o: src/chromflock_init.c
$(CC) -c $(CFLAGS) src/chromflock_init.c -o obj/chromflock_init.o
obj/ellipsoid.o: src/ellipsoid.c
$(CC) -c $(CFLAGS) src/ellipsoid.c -o obj/ellipsoid.o
obj/balance.o: src/balance.c
$(CC) -c $(CFLAGS) src/balance.c -o obj/balance.o
obj/contact_pairs_io.o: src/contact_pairs_io.c
$(CC) -c $(CFLAGS) src/contact_pairs_io.c -o obj/contact_pairs_io.o
obj/cf_util.o: src/cf_util.c src/cf_util.h
$(CC) -c $(CFLAGS) src/cf_util.c -o obj/cf_util.o