add missing line to command line help
[project/uci.git] / Makefile
1 VERSION=0.1
2
3 COPTS=-O2
4 WOPTS=-pedantic -Wno-unused -Werror
5 FPIC=-fPIC
6 CFLAGS=$(COPTS) $(WOPTS) -Wall -std=gnu99
7
8 AR=ar
9 LD=ld
10 CC=gcc
11 LIBS=-lc
12 RANLIB=ranlib
13
14 ifneq ($(DEBUG),)
15   COPTS = -O0
16   CFLAGS += -g3 -DDEBUG_ALL
17 endif
18 OS=$(shell uname)
19 ifeq ($(OS),Darwin)
20   LINK=$(LD)
21   SHLIB_EXT=dylib
22   SHLIB_FLAGS=-dylib
23 else
24   LINK=$(CC)
25   SHLIB_EXT=so
26   SHLIB_FLAGS=-shared -Wl,-soname,$(SHLIB_FILE)
27 endif
28 SHLIB_FILE=libuci.$(SHLIB_EXT).$(VERSION)
29
30 LIBUCI_DEPS=file.c history.c list.c util.c err.h uci.h
31
32 all: uci-static uci libuci.$(SHLIB_EXT)
33
34 cli.o: cli.c uci.h
35
36 uci: cli.o libuci.$(SHLIB_EXT)
37         $(CC) -o $@ $< -L. -luci
38
39 uci-static: cli.o libuci.a
40         $(CC) $(CFLAGS) -o $@ $^
41
42 libuci-static.o: libuci.c $(LIBUCI_DEPS)
43         $(CC) $(CFLAGS) -c -o $@ $<
44
45 libuci-shared.o: libuci.c $(LIBUCI_DEPS)
46         $(CC) $(CFLAGS) $(FPIC) -c -o $@ $<
47
48 libuci.a: libuci-static.o
49         rm -f $@
50         $(AR) rc $@ $^
51         $(RANLIB) $@
52
53 libuci.$(SHLIB_EXT): libuci-shared.o
54         $(LINK) $(SHLIB_FLAGS) -o $(SHLIB_FILE) $^ $(LIBS)
55         ln -sf $(SHLIB_FILE) $@
56
57 clean:
58         rm -f uci uci-static *.[oa] *.so* *.dylib*