blob: fbcffca56b7e84be40c9c308b3b9f1772c86e47a (
plain)
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
|
# DEVICEATLAS_SRC : DeviceAtlas API source root path
OS := $(shell uname -s)
OBJS := dadwsch.o
CFLAGS := -g -O2
LDFLAGS :=
CURL_CONFIG := curl-config
CURLDIR := $(shell $(CURL_CONFIG) --prefix 2>/dev/null || echo /usr/local)
CURL_INC := $(CURLDIR)/include
CURL_LIB := $(CURLDIR)/lib
CURL_LDFLAGS := $(shell $(CURL_CONFIG) --libs 2>/dev/null || echo -L /usr/local/lib -lcurl)
PCRE2_CONFIG := pcre2-config
PCRE2DIR := $(shell $(PCRE2_CONFIG) --prefix 2>/dev/null || echo /usr/local)
PCRE2_INC := $(PCRE2DIR)/include
PCRE2_LIB := $(PCRE2DIR)/lib
PCRE2_LDFLAGS := $(shell $(PCRE2_CONFIG) --libs8 2>/dev/null || echo /usr/local)
ifeq ($(DEVICEATLAS_SRC),)
dadwsch: dadwsch.c
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
LDFLAGS += -lda
else
DEVICEATLAS_INC = $(DEVICEATLAS_SRC)
DEVICEATLAS_LIB = $(DEVICEATLAS_SRC)
CFLAGS += -DDA_REGEX_HDR=\"dac_pcre2.c\" -DDA_REGEX_TAG=2
CFLAGS += -DMOBI_CURL -DMOBI_CURLSSET -DMOBI_GZ -DMOBI_ZIP
CFLAGS += -I$(DEVICEATLAS_INC) -I$(CURL_INC) -I$(PCRE2DIR)
LDFLAGS += $(CURL_LDFLAGS) $(PCRE2_LDFLAGS) -lz -lzip -lpthread
dadwsch: dadwsch.c $(DEVICEATLAS_SRC)/dac.c $(DEVICEATLAS_SRC)/dasch.c $(DEVICEATLAS_SRC)/dadwarc.c $(DEVICEATLAS_SRC)/dadwcom.c $(DEVICEATLAS_SRC)/dadwcurl.c $(DEVICEATLAS_SRC)/json.c $(DEVICEATLAS_SRC)/Os/daunix.c
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
endif
ifeq ($(OS), Linux)
LDFLAGS += -lrt
endif
ifeq ($(OS), SunOS)
LDFLAGS += -lrt
endif
clean:
rm -f *.o
rm -f $(DEVICEATLAS_LIB)*.o
rm -f dadwsch
|