Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 61 lines (39 sloc) 1.068 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
0c62f74 @rofl0r Makefile: use lib prefix
rofl0r authored
18 ALL_LIBS=libtermbox.a
4b7e797 @rofl0r add Makefile
rofl0r authored
19 ALL_DEMOS=keyboard_demo
20
21 CFLAGS=-fPIC -O0 -g -std=gnu99 -D_GNU_SOURCE
22
23 AR = $(CROSS_COMPILE)ar
24 RANLIB = $(CROSS_COMPILE)ranlib
25
26
27 -include config.mak
28
29 BUILDCFLAGS=$(CFLAGS)
30
31 all: $(ALL_LIBS) $(ALL_DEMOS)
32
33 install: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(ALL_INCLUDES:include/%=$(DESTDIR)$(includedir)/%)
34
35 clean:
36 rm -f $(ALL_LIBS)
37 rm -f $(ALL_DEMOS)
38 rm -f $(OBJS)
39
40 %.o: %.c
41 $(CC) $(BUILDCFLAGS) -c -o $@ $<
42
0c62f74 @rofl0r Makefile: use lib prefix
rofl0r authored
43 libtermbox.a: $(LIBOBJS)
4b7e797 @rofl0r add Makefile
rofl0r authored
44 rm -f $@
45 $(AR) rc $@ $(LIBOBJS)
46 $(RANLIB) $@
47
48 keyboard_demo: $(OBJS)
49 $(CC) $(LDFLAGS) -o $@ $(OBJS)
50
51 $(DESTDIR)$(libdir)/%.a: %.a
52 install -D -m 755 $< $@
53
54 $(DESTDIR)$(includedir)/%: include/%
55 install -D -m 644 $< $@
56
57 .PHONY: all clean install
58
59
60
Something went wrong with that request. Please try again.