This repository has been archived by the owner on Mar 19, 2021. It is now read-only.
forked from emcvipr/atmos-client-c
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.old
82 lines (61 loc) · 1.98 KB
/
Makefile.old
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
SRC=atmos.c atmos_util.c atmos_client.c atmos_common.c atmos_create.c \
atmos_service_info.c atmos_read.c
TESTSRC=seatest.c test.c test_atmos.c
OUTPUT_DIR=output
TEST_OUTPUT_DIR=testout
OBJ=$(addprefix $(OUTPUT_DIR)/,$(SRC:.c=.o))
TESTOBJ=$(addprefix $(TEST_OUTPUT_DIR)/,$(TESTSRC:.c=.o))
TESTEXE=$(TEST_OUTPUT_DIR)/atmostest
UNAME := $(shell uname)
VERSION = 2.1.0
SLIBNAME = libatmos.so
LIBNAME = libatmos.a
LIBDIR = -L/usr/local/lib
XMLLIBS := $(shell xml2-config --libs)
XMLCFLAGS := $(shell xml2-config --cflags)
LIBS= -lssl -lcrypto -lcurl $(XMLLIBS)
CFLAGS = -Iinclude -Idep/rest-client-c/include -Wall -fPIC -g -c -D_FILE_OFFSET_BITS=64 -pthreads $(XMLCFLAGS)
SOFLAGS = -shared -Wl,-soname,$(SLIBNAME) -o $(SLIBNAME)
DEPLIB = $(OUTPUT_DIR)/librest.a
TESTLINK = -L$(OUTPUT_DIR) -latmos -lrest $(XMLLIBS)
ifeq ($(UNAME), Darwin)
SLIBNAME = atmos.dylib
SOFLAGS = -dynamiclib -undefined suppress -flat_namespace -o $(OUTPUT_DIR)/$(SLIBNAME)
endif
all: dep prepare lib testharness
dep: rest-client-c
rest-client-c: dep/rest-client-c/output/librest.a
dep/rest-client-c/output/librest.a:
cd dep/rest-client-c; make lib
prepare:
mkdir -p $(OUTPUT_DIR)
mkdir -p $(TEST_OUTPUT_DIR)
lib: prepare $(OBJ)
gcc $(SOFLAGS) $(OBJ)
cd $(OUTPUT_DIR); ar rcs $(LIBNAME) *.o
$(OUTPUT_DIR)/%.o : src/%.c
gcc -c $(CFLAGS) $< -o $@
$(TEST_OUTPUT_DIR)/%.o : test/%.c
gcc -c $(CFLAGS) $< -o $@
$(OUTPUT_DIR)/librest.a : dep/rest-client-c/output/librest.a
cp dep/rest-client-c/output/librest.a $(OUTPUT_DIR)/librest.a
testharness: lib $(TESTOBJ) $(DEPLIB)
gcc -pg -g -o $(TESTEXE) $(TESTLINK) $(LIBDIR) $(LIBS) $(TESTOBJ)
test: testharness
$(TESTEXE)
doc:
doxygen Doxyfile
tar:
mkdir -p tar
mkdir -p tar/atmos-c
cp -r src test Makefile Doxyfile include tar/atmos-c
find tar -name .svn | xargs rm -rf
cd tar; tar cvzf ../atmos-c_$(VERSION).tar.gz atmos-c
rm -rf tar
clean:
rm -f *.o
rm -f *.so
rm -f *.dylib
rm -rf $(OUTPUT_DIR)
rm -rf $(TEST_OUTPUT_DIR)
cd dep/rest-client-c; make clean