-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.gcc
100 lines (79 loc) · 2.82 KB
/
Makefile.gcc
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
# Makefile for fl_imgtk
# (C)2017 Raphael Kim / rageworx@gmail.com
#
#########################################################################
# About cross compiler, or other platform :
#
# To enable build for embedded linux, you may encomment next 2 lines.
# Or, may need to change your cross compiler path with environments.
# It is up to developer !
# CCPREPATH = ${ARM_LINUX_GCC_PATH}
# CCPREFIX = arm-linux-
# To enable build for embedded linux, change following line.
# CCPATH = ${CCPREPATH}/${CCPREFIX}
CCPATH =
#########################################################################
# Compiler configure.
GCC = ${CCPATH}gcc
GPP = ${CCPATH}g++
AR = ${CCPATH}ar
# FLTK place
FLTKDIR = $(shell fltk-config --use-images --includedir)
FLTKCXX = $(shell fltk-config --use-images --cxxflags)
# Sources and how it built
# Optimization issue: recommend to build with using -ffast-math option.
# Change if your CPU architecture supports more high technologies.
INCDIR = ./inc
SOURCEDIR = ./src
OBJDIR = ./obj
OUTBIN = libfl_imgtk.a
OUTDIR = ./lib
INSTALLDIR = /usr/local
DEFINEOPT = -DUSING_INTERPOLATED_ROTATE_FREE -DUSING_OMP
DEFINEOPT += $(FLTKCXX)
OPTIMIZEOPT = -ffast-math -fopenmp -O3 -s
CPUARCHOPT =
ifeq (debug,$(firstword $(MAKECMDGOALS)))
DEFINEOPT += -DDEBUG
OPTIMIZEOPT = -ffast-math -g
OUTBIN = libfl_imgtk_d.a
endif
CFLAGS += -std=c++11
CFLAGS += -I$(INCDIR) -I$(SOURCEDIR) -I$(FLTKDIR)
CFLAGS += $(DEFINEOPT) $(OPTIMIZEOPT) $(CPUARCHOPT) $(BITSOPT)
.PHONY: prepare clean install uninstall
all: prepare ${OUTDIR}/${OUTBIN}
debug: all
prepare:
@mkdir -p ${OBJDIR}
@mkdir -p ${OUTDIR}
${OBJDIR}/fl_imgtk_tonemap.o:
@$(GPP) -c ${SOURCEDIR}/fl_imgtk_tonemap.cpp ${CFLAGS} -o $@
${OBJDIR}/fl_smimg.o:
@$(GPP) -c ${SOURCEDIR}/fl_smimg.cpp ${CFLAGS} -o $@
${OBJDIR}/fl_imgtk_clahe.o:
@$(GPP) -c ${SOURCEDIR}/fl_imgtk_clahe.cpp ${CFLAGS} -o $@
${OBJDIR}/fl_imgtk.o:
@$(GPP) -c ${SOURCEDIR}/fl_imgtk.cpp ${CFLAGS} -o $@
${OUTDIR}/${OUTBIN}: ${OBJDIR}/fl_imgtk_tonemap.o ${OBJDIR}/fl_smimg.o ${OBJDIR}/fl_imgtk_clahe.o ${OBJDIR}/fl_imgtk.o
@echo "Generating $@ ..."
@$(AR) -q $@ ${OBJDIR}/*.o
@cp -f ${INCDIR}/fl_imgtk.h ${OUTDIR}
clean:
@echo "Cleaning built directories ..."
@rm -rf ${OBJDIR}/*
@rm -rf ${OUTDIR}/${OUTBIN}
install:
@if [ ! -e ${OUTDIR}/${OUTBIN} ];then echo "Error: library is not built yey, build it and try again"; exit 1; fi
@echo "Installing library .."
@cp -f ${OUTDIR}/${OUTBIN} ${INSTALLDIR}/lib
@echo "Installing header .."
@mkdir -p ${INSTALLDIR}/include
@cp -f ${INCDIR}/fl_imgtk.h ${INSTALLDIR}/include
uninstall:
@if [ -e ${INSTALLDIR}/lib/${OUTBIN} ];then \
echo "Removing library ...";\
rm -f ${INSTALLDIR}/lib/${OUTBIN}; fi
@if [ -e ${INSTALLDIR}/include/fl_imgtk.h ]; then \
echo "Removing header ...";\
rm -f ${INSTALLDIR}/include/fl_imgtk.h; fi