-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
60 lines (45 loc) · 1.26 KB
/
Makefile
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
.PHONY: default clean libs install uninstall doxygen
CC := cc
CCFLAGS = -Wall -Wextra -Werror -pedantic -g -O3 -fPIC
CFILES = str.c wstr.c
HFILES = str.h wstr.h
OFILES = $(patsubst %.c, %.o, $(CFILES))
LIBFILES = libstr.so libstr-static.a
AR = ar
ARFLAGS = rcs
INSTALL_PATH ?= /usr/local
default: libs
libs: $(LIBFILES)
$(LIBFILES): $(OFILES) $(HFILES)
@ echo " => libstr.so"
@ $(CC) $(CCFLAGS) -shared -o libstr.so $(OFILES)
@ echo " => libstr-static.so"
@ $(AR) $(ARFLAGS) libstr-static.a $(OFILES)
install: libs
install -d $(INSTALL_PATH)/lib
install -m 644 libstr* $(INSTALL_PATH)/lib
install -d $(INSTALL_PATH)/include
install -m 644 *.h $(INSTALL_PATH)/include
ldconfig $(INSTALL_PATH)/lib
uninstall:
rm -f $(INSTALL_PATH)/lib/libstr.so
rm -f $(INSTALL_PATH)/lib/libstr.a
rm -f $(INSTALL_PATH)/include/str.h
rm -f $(INSTALL_PATH)/include/wstr.h
ldconfig $(INSTALL_PATH)/lib
doxygen: ./doxygen/
@ echo -e "\
/** @mainpage \n \
@verbinclude README \n \
*//**\
@file str.h string_t definition. \n \
@file wstr.h wstring_t definition. \n */" > ./doxygen/doc.doxy
@ doxygen .doxyfile
@ rm -f ./doxygen/doc.doxy
%/:
@ mkdir $@
.c.o:
@ echo " CC $@"
@ $(CC) $(CCFLAGS) -c -o $@ $<
clean:
@ rm -rf *.o doxygen $(LIBFILES)