-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.old
51 lines (40 loc) · 1.37 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
LIB_TARGET_STATIC := libcyberiadaml.a
LIB_TARGET_DYNAMIC := libcyberiadaml.so
ifeq ($(DYNAMIC), 1)
LIB_TARGET := $(LIB_TARGET_DYNAMIC)
else
LIB_TARGET := $(LIB_TARGET_STATIC)
endif
TEST_TARGET := cyberiada_test
LIB_SOURCES := cyberiadaml.c utf8enc.c cyb_types.c cyb_string.c
TEST_SOURCES := test.c
LIB_OBJECTS := $(patsubst %.c, %.o, $(LIB_SOURCES))
TEST_OBJECTS := $(patsubst %.c, %.o, $(TEST_SOURCES))
ifeq ($(DEBUG), yes)
CFLAGS := -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wconversion -fPIC -g3 -D__DEBUG__
LFLAGS :=
else ifeq ($(DEBUG), asan)
CFLAGS := -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wconversion -fsanitize=address -fPIC -g3 -D__DEBUG__
LFLAGS := -fsanitize=address -static-libasan
else
CFLAGS := -fPIC
LFLAGS :=
endif
INCLUDE := -I. -I/usr/include/libxml2
LIBS := -L/usr/lib -lxml2 -lm
TEST_LIBS := -L. -lcyberiadaml
$(LIB_TARGET): $(LIB_OBJECTS)
ifeq ($(DYNAMIC), yes)
gcc -shared $(LIBS) $(LIB_OBJECTS) -o $@
else
ar rcs $@ $(LIB_OBJECTS)
endif
$(TEST_TARGET): $(TEST_OBJECTS) $(LIB_TARGET) $(LIB_ORJECTS)
gcc $(TEST_OBJECTS) $(LFLAGS) -Wl,--no-as-needed $(LIBS) $(TEST_LIBS) -o $@
%.o: %.c
gcc -c $< $(CFLAGS) $(INCLUDE) -o $@
clean:
rm -f *~ *.o $(TARGET) $(TEST_TARGET) $(LIB_TARGET_STATIC) $(LIB_TARGET_DYNAMIC)
test: $(TEST_TARGET)
all: $(LIB_TARGET) $(TEST_TARGET)
.PHONY: all clean test