Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: d45c38fa52
Fetching contributors…

Cannot retrieve contributors at this time

file 61 lines (42 sloc) 1.178 kb
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
prefix=/usr/local
bindir=$(prefix)/bin
includedir=$(prefix)/include
libdir=$(prefix)/lib
sysconfdir=$(prefix)/etc

LIBSRC = $(sort $(wildcard src/*.c))
DEMOSRC = $(sort $(wildcard src/demo/*.c))

SRCS = $(LIBSRC) $(DEMOSRC)
OBJS = $(SRCS:.c=.o)
LIBOBJS = $(LIBSRC:.c=.o)
DEMOOBJS = $(DEMOSRC:.c=.o)

HEADERS = src/termbox.h
ALL_INCLUDES = $(HEADERS)

SHARED_LIBS=libtermbox.so
ALL_LIBS=libtermbox.a
ALL_DEMOS=keyboard_demo

CFLAGS=-fPIC -O0 -g -std=gnu99 -D_GNU_SOURCE

AR = $(CROSS_COMPILE)ar
RANLIB = $(CROSS_COMPILE)ranlib


-include config.mak

BUILDCFLAGS=$(CFLAGS)

all: $(ALL_LIBS) $(ALL_DEMOS) $(SHARED_LIBS)

install: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(ALL_INCLUDES:include/%=$(DESTDIR)$(includedir)/%)

clean:
rm -f $(ALL_LIBS)
rm -f $(ALL_DEMOS)
rm -f $(OBJS)

%.o: %.c
$(CC) $(BUILDCFLAGS) -c -o $@ $<

libtermbox.a: $(LIBOBJS)
rm -f $@
$(AR) rc $@ $(LIBOBJS)
$(RANLIB) $@

libtermbox.so: $(LIBOBJS)
gcc -shared -o $(SHARED_LIBS) $(LIBOBJS)

keyboard_demo: $(OBJS)
$(CC) $(LDFLAGS) -o $@ $(OBJS)

$(DESTDIR)$(libdir)/%.a: %.a
install -D -m 755 $< $@

$(DESTDIR)$(includedir)/%: include/%
install -D -m 644 $< $@

.PHONY: all clean install
Something went wrong with that request. Please try again.