Skip to content

Commit

Permalink
Expand Makefile to handle Buildroot compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
zear committed Oct 4, 2015
1 parent 4e03894 commit 4e00f39
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ endif

CC ?= gcc
STRIP ?= strip
NAME := libshake.so
LIBNAME := libshake.so
SOVERSION := 0
SONAME := $(NAME).$(SOVERSION)
SONAME := $(LIBNAME).$(SOVERSION)
TARGET ?= $(SONAME)
SYSROOT := $(shell $(CC) --print-sysroot)
DESTDIR ?= $(SYSROOT)
PREFIX ?= /usr
CFLAGS := -fPIC
SRCDIR := src
OBJDIR := obj
Expand Down Expand Up @@ -38,11 +40,14 @@ $(OBJ): $(OBJDIR)/%.o: $(SRCDIR)/%.c | $(OBJDIR)
$(OBJDIR):
mkdir -p $@

clean:
rm -Rf $(TARGET) $(OBJDIR)
install-headers:
cp include/*.h $(DESTDIR)$(PREFIX)/include/

install-lib:
cp $(TARGET) $(DESTDIR)$(PREFIX)/lib/
ln -sf $(DESTDIR)$(PREFIX)/lib/$(TARGET) $(DESTDIR)$(PREFIX)/lib/$(LIBNAME)

install: $(TARGET)
cp include/*.h $(SYSROOT)/usr/include/
cp $(TARGET) $(SYSROOT)/usr/lib/
ln -sf $(SYSROOT)/usr/lib/$(TARGET) $(SYSROOT)/usr/lib/$(NAME)
install: $(TARGET) install-headers install-lib

clean:
rm -Rf $(TARGET) $(OBJDIR)

0 comments on commit 4e00f39

Please sign in to comment.