Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 65 lines (42 sloc) 1.178 kB
4b7e797 @rofl0r add Makefile
rofl0r authored
1 prefix=/usr/local
2 bindir=$(prefix)/bin
3 includedir=$(prefix)/include
4 libdir=$(prefix)/lib
5 sysconfdir=$(prefix)/etc
6
7 LIBSRC = $(sort $(wildcard src/*.c))
8 DEMOSRC = $(sort $(wildcard src/demo/*.c))
9
10 SRCS = $(LIBSRC) $(DEMOSRC)
11 OBJS = $(SRCS:.c=.o)
12 LIBOBJS = $(LIBSRC:.c=.o)
13 DEMOOBJS = $(DEMOSRC:.c=.o)
14
15 HEADERS = src/termbox.h
16 ALL_INCLUDES = $(HEADERS)
17
d45c38f @pschuegr added shared lib target to Makefile
pschuegr authored
18 SHARED_LIBS=libtermbox.so
0c62f74 @rofl0r Makefile: use lib prefix
rofl0r authored
19 ALL_LIBS=libtermbox.a
4b7e797 @rofl0r add Makefile
rofl0r authored
20 ALL_DEMOS=keyboard_demo
21
22 CFLAGS=-fPIC -O0 -g -std=gnu99 -D_GNU_SOURCE
23
24 AR = $(CROSS_COMPILE)ar
25 RANLIB = $(CROSS_COMPILE)ranlib
26
27
28 -include config.mak
29
30 BUILDCFLAGS=$(CFLAGS)
31
d45c38f @pschuegr added shared lib target to Makefile
pschuegr authored
32 all: $(ALL_LIBS) $(ALL_DEMOS) $(SHARED_LIBS)
4b7e797 @rofl0r add Makefile
rofl0r authored
33
34 install: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(ALL_INCLUDES:include/%=$(DESTDIR)$(includedir)/%)
35
36 clean:
37 rm -f $(ALL_LIBS)
38 rm -f $(ALL_DEMOS)
39 rm -f $(OBJS)
40
41 %.o: %.c
42 $(CC) $(BUILDCFLAGS) -c -o $@ $<
43
0c62f74 @rofl0r Makefile: use lib prefix
rofl0r authored
44 libtermbox.a: $(LIBOBJS)
4b7e797 @rofl0r add Makefile
rofl0r authored
45 rm -f $@
46 $(AR) rc $@ $(LIBOBJS)
47 $(RANLIB) $@
48
d45c38f @pschuegr added shared lib target to Makefile
pschuegr authored
49 libtermbox.so: $(LIBOBJS)
50 gcc -shared -o $(SHARED_LIBS) $(LIBOBJS)
51
4b7e797 @rofl0r add Makefile
rofl0r authored
52 keyboard_demo: $(OBJS)
53 $(CC) $(LDFLAGS) -o $@ $(OBJS)
54
55 $(DESTDIR)$(libdir)/%.a: %.a
56 install -D -m 755 $< $@
57
58 $(DESTDIR)$(includedir)/%: include/%
59 install -D -m 644 $< $@
60
61 .PHONY: all clean install
62
63
64
Something went wrong with that request. Please try again.