-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.mk
More file actions
157 lines (131 loc) · 3.97 KB
/
common.mk
File metadata and controls
157 lines (131 loc) · 3.97 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
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
CC = gcc
CPP = g++
VERSION_MAJOR = 3
VERSION_MINOR = 0.12
LFLAGS_LIB =
LFLAGS_APP = -L${SEABREEZE}/lib -L${SEABREEZE}
CFLAGS_BASE = -I${SEABREEZE}/include \
-c \
-Wall \
-Wunused \
-Wmissing-include-dirs \
-O0 \
-fpic \
-fno-stack-protector \
-shared
export UNAME = $(shell uname)
# MacOS X configuration
ifeq ($(UNAME), Darwin)
LIBBASENAME = libseabreeze
SUFFIX = dylib
LFLAGS_APP += -L/usr/lib \
-lstdc++
LFLAGS_LIB += -dynamic \
-dynamiclib \
-framework Carbon \
-framework CoreFoundation \
-framework IOKit
CFLAGS_BASE = -I${SEABREEZE}/include \
-c \
-Wall \
-Wunused \
-Wmissing-include-dirs \
-g \
-O0 \
-fpic \
-fno-stack-protector
# Cygwin-32 configuration
else ifeq ($(findstring CYGWIN, $(UNAME)), CYGWIN)
# caller can override this, but this is the current Ocean Optics default
VISUALSTUDIO_PROJ ?= VisualStudio2010
LIBBASENAME = SeaBreeze
SUFFIX = dll
CFLAGS_BASE = -I${SEABREEZE}/include \
-c \
-Wall \
-Wunused \
-ggdb3 \
-shared
# MinGW-32 configuration
else ifeq ($(findstring MINGW, $(UNAME)), MINGW)
SUFFIX = dll
LFLAGS_APP += -L/local/lib \
-lusb0 \
-lstdc++ \
-lm
LFLAGS_LIB += -L/local/lib \
-lusb0 \
-shared
# Linux configuration
else
SUFFIX = so
LIBBASENAME = libseabreeze
LFLAGS_APP += -L/usr/lib \
-lusb \
-lstdc++ \
-lm
LFLAGS_LIB += -L/usr/lib \
-shared \
-fPIC -Wl,-soname,libseabreeze.so.3
endif
# enable Logger
CFLAGS_BASE += -DOOI_DEBUG
# these are for the .o files making up libseabreeze
# added -std=c++14, HB, Thu Nov 2 14:35:38 CET 2023
CPPFLAGS = $(CFLAGS_BASE) -std=c++17
CFLAGS = $(CFLAGS_BASE) -std=gnu99
# allow for a 32 bit build
ifdef wordwidth
ifeq ($(wordwidth),32)
CPPFLAGS += -arch i386
CFLAGS += -arch i386
LFLAGS_APP += -arch i386
LFLAGS_LIB += -arch i386
endif
endif
export LIBNAME=$(LIBBASENAME).$(VERSION_MAJOR).$(VERSION_MINOR).$(SUFFIX)
SUFFIXES = .c .cpp .o .d
SRCS_CPP := $(wildcard *.cpp)
DEPS_CPP := $(patsubst %.cpp,%.d,$(SRCS_CPP))
OBJS_CPP := $(patsubst %.cpp,%.o,$(SRCS_CPP))
SRCS_C := $(wildcard *.c)
DEPS_C := $(patsubst %.c,%.d,$(SRCS_C))
OBJS_C := $(patsubst %.c,%.o,$(SRCS_C))
VISUALSTUDIO_PROJECTS = VisualStudio2005 \
VisualStudio2010 \
VisualStudio2012 \
VisualStudio2013
ifneq ($(MAKECMDGOALS),clean)
-include $(DEPFILES)
endif
deps: ${DEPS_CPP} ${DEPS_C}
%.d: %.cpp
@echo caching $@
@${CPP} ${CPPFLAGS} -MM $< | sed "s/$*.o/& $@/g" > $@
%.d: %.c
@echo caching $@
@${CC} ${CFLAGS} -MM $< | sed "s/$*.o/& $@/g" > $@
%.o: %.cpp
@echo building $@
@${CPP} ${CPPFLAGS} $< -o $@
%.o: %.c
@echo building $@
@${CC} ${CFLAGS} $< -o $@
objs: subdirs ${OBJS_CPP} ${OBJS_C}
@/bin/cp *.o ${SEABREEZE}/lib 1>/dev/null 2>&1 || true
subdirs:
@if [ "$(SUBDIRS)" ] ; then for d in $(SUBDIRS) ; do $(MAKE) -C $$d || exit ; done ; else true ; fi
clean:
@echo cleaning $$PWD
@for d in $(SUBDIRS); do $(MAKE) -C $$d $@ || exit; done
@$(RM) -f *.d *.o *.obj *.exe *.stackdump lib/* $(APPS)
@for VS in $(VISUALSTUDIO_PROJECTS) ; \
do \
if [ -d os-support/windows/$$VS ] ; \
then \
echo cleaning os-support/windows/$$VS ; \
( cd os-support/windows/$$VS && $(MAKE) clean ) || exit ; \
fi ; \
done
@if [ -d doc ] ; then ( cd doc && $(RM) -rf man rtf html *.err ) ; fi
new: clean all