forked from mnhrdt/imscript
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
84 lines (59 loc) · 2.45 KB
/
Copy pathMakefile
File metadata and controls
84 lines (59 loc) · 2.45 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
CFLAGS ?= -march=native -O3
LDLIBS += -ljpeg -ltiff -lpng -lz -lfftw3f -lm
OBJ = src/iio.o src/fancy_image.o
BIN = plambda vecov veco vecoh morsi downsa upsa ntiply censust dither qauto \
qeasy homwarp synflow backflow flowinv nnint bdint amle simpois ghisto \
contihist fontu imprintf pview viewflow flowarrows palette ransac blur \
srmatch tiffu siftu crop lrcat tbcat fftshift bmms registration imflip \
fft dct dht flambda fancy_crop fancy_downsa autotrim iion mediator \
BIN := $(addprefix bin/,$(BIN))
default: $(BIN)
bin/% : src/%.o $(OBJ)
$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
# END OF CORE PART, THE REST OF THIS FILE IS NOT ESSENTIAL
# unit test (end-to-end)
ifeq ($(MAKECMDGOALS),test)
LDLIBS := $(filter-out -lfftw3f,$(LDLIBS))
endif
test: bin/plambda bin/imprintf
echo $(MAKECMDGOALS)
bin/plambda zero:512x512 "randg randg randl randg randg 5 njoin" \
| bin/plambda - "split rot del hypot" | bin/imprintf "%s%e%r%i%a\n" \
| grep -q 3775241.440161.730120.0037888911.8794
# hack (compatibility flags for old compilers)
#
# The following conditional statement appends "-std=gnu99" to CFLAGS when the
# compiler does not define __STDC_VERSION__. The idea is that many older
# compilers are able to compile standard C when given that option.
# This hack seems to work for all versions of gcc, clang and icc.
ifeq (,$(shell $(CC) $(CFLAGS) -dM -E -< /dev/null | grep __STDC_VERSION_))
CFLAGS := $(CFLAGS) -std=gnu99
endif
# exotic targets, not built by default
# FTR: interactive tools, require X11 or freeglut
# MSC: "misc" tools, or those requiring GSL
OBJ_FTR = src/iio.o src/ftr/ftr.o src/ftr/egm96.o
BIN_FTR = $(shell cat src/ftr/TARGETS)
BIN_MSC = $(shell cat src/misc/TARGETS)
BIN_FTR := $(addprefix bin/,$(BIN_FTR))
BIN_MSC := $(addprefix bin/,$(BIN_MSC))
LDLIBS_FTR = $(LDLIBS) -lX11
LDLIBS_MSC = $(LDLIBS) -lgsl -lgslcblas
OBJ_ALL = $(OBJ) $(OBJ_FTR)
BIN_ALL = $(BIN) $(BIN_FTR) $(BIN_MSC)
full : default ftr misc
ftr : $(BIN_FTR)
misc : $(BIN_MSC)
bin/% : src/ftr/%.o $(OBJ_FTR)
$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS_FTR)
bin/% : src/misc/%.o $(OBJ)
$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS_MSC)
# single, fat, busybox-like executable
BINOBJ = $(BIN:bin/%=src/%.o) $(BIN_FTR:bin/%=src/ftr/%.o)
bin/im : src/im.o $(BINOBJ) $(OBJ_ALL)
$(CC) $(LDFLAGS) -Wl,--allow-multiple-definition -o $@ $^ $(LDLIBS_FTR)
# bureaucracy
clean:
$(RM) $(BIN_ALL) bin/im src/*.o src/ftr/*.o src/misc/*.o
.PHONY: default full ftr misc clean
.PRECIOUS: %.o