-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
68 lines (45 loc) · 1.54 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
61
62
63
64
65
66
67
68
#
# libconfigini - an ini formatted configuration parser library
# Copyright (C) 2013-present Taner YILMAZ <taner44 AT gmail.com>
#
LIB = configini
LIBARCH = $(patsubst %,lib%.a,${LIB})
HDRS = src/configini.h src/queue.h
SRCS = src/configini.c
INSTALLHDRS = src/configini.h
OBJS := ${SRCS:.c=.o}
# library installation directory
INSTALLDIR = /usr/local
CFLAGS = -g -Wall -Wno-char-subscripts
CC = gcc
###################################################################################################
ifdef installdir
INSTALLDIR = $(installdir)
endif
.PHONY: all install test clean doc help
all: $(LIBARCH)
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
$(LIBARCH): $(OBJS)
ar rcs $(LIBARCH) $(OBJS)
install: all
@mkdir -p $(INSTALLDIR)/include && cp $(INSTALLHDRS) $(INSTALLDIR)/include
@mkdir -p $(INSTALLDIR)/lib && cp $(LIBARCH) $(INSTALLDIR)/lib
test: $(LIBARCH)
$(MAKE) -C tests/
clean:
rm -f ~core~ *.stackdump $(OBJS) $(LIBARCH)
rm -rf html/
$(MAKE) -C tests/ clean
doc: docs/html.dox
@mkdir -p html
@doxygen docs/html.dox
help:
@echo "Installdir: $(INSTALLDIR)"
@echo "targets:"
@echo " all Build all"
@echo " installdir=<path> Install library to path"
@echo " install Install library to $INSTALLDIR/lib and its header to $INSTALLDIR/include"
@echo " test Run unittests"
@echo " clean Clean library generated files"
@echo " doc Generate documentation (as doxygen)"