Commit 6ec51552 authored by Josh Kunz's avatar Josh Kunz

Fixes Makefile to work with no 'lib' directory

parent 7d29f5c9
......@@ -6,6 +6,7 @@
.PHONY: default clean
AR = ar
CC = cc
CFLAGS = -I./include
......@@ -13,7 +14,8 @@ headers = $(wildcard include/*)
sources = $(wildcard src/*)
objects = $(patsubst %.c,%.o,$(sources))
lib = ./lib/libcap.a
libdir = ./lib
lib = $(libdir)/libcap.a
default: $(lib)
......@@ -21,8 +23,9 @@ default: $(lib)
$(CC) $(CFLAGS) -o $@ -c $<
$(lib): $(objects)
ar -cvq $@ $^
@if [[ ! -d $(libdir) ]]; then mkdir $(libdir); fi
$(AR) -cq $@ $^
clean:
-rm -f $(lib)
-rm -rf $(libdir)
-rm -f $(objects)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment