Skip to content

Commit

Permalink
Allow installation
Browse files Browse the repository at this point in the history
  • Loading branch information
kylelaker committed Jan 4, 2020
1 parent 5bf45e3 commit eaedf1f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ override LDFLAGS := $(LDFLAGS)
SRCDIR = src
OUTDIR = build
INCDIR = include
PREFIX = /usr

SRCS = $(shell find $(SRCDIR) -type f -name *.c)
OBJS = $(patsubst $(SRCDIR)/%,$(OUTDIR)/%,$(SRCS:.c=.o))
SHOBJS = $(patsubst $(SRCDIR)/%,$(OUTDIR)/lib%,$(SRCS:.c=.so))
INC = -I$(INCDIR)

EXE=list_test

all: libs

libs: $(OBJS)
libs: $(OBJS) $(SHOBJS)

test:
make -C tests
Expand All @@ -29,8 +31,17 @@ $(OUTDIR)/%.o: $(SRCDIR)/%.c
mkdir -p $(OUTDIR)
$(CC) -c $(CFLAGS) $(INC) $< -o $@

$(OUTDIR)/lib%.so: $(OUTDIR)/%.o
$(CC) $(CFLAGS) -shared -o $@ $<

install: $(SHOBJS)
install -d $(DESTDIR)$(PREFIX)/lib/
install -m 644 $(SHOBJS) $(DESTDIR)$(PREFIX)/lib/
install -d $(DESTDIR)$(PREFIX)/include/xorlist
install -m 644 $(INCDIR)/* $(DESTDIR)$(PREFIX)/include/xorlist/

clean:
rm -rf $(OUTDIR)/*.o list_test
rm -rf $(OUTDIR) list_test
make -C tests clean

.PHONY: all default clean tests
.PHONY: all default clean tests install
File renamed without changes.

0 comments on commit eaedf1f

Please sign in to comment.