Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add Makefile

  • Loading branch information...
commit 4b7e7973056436c64ddd33e5d9e84e809ef72669 1 parent 0f7df1a
@rofl0r rofl0r authored
Showing with 60 additions and 0 deletions.
  1. +60 −0 Makefile
View
60 Makefile
@@ -0,0 +1,60 @@
+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)
+
+ALL_LIBS=termbox.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)
+
+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 $@ $<
+
+termbox.a: $(LIBOBJS)
+ rm -f $@
+ $(AR) rc $@ $(LIBOBJS)
+ $(RANLIB) $@
+
+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
+
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.