Permalink
Browse files

Fix the Makefile for liblcthw and use the latest from the book.

  • Loading branch information...
1 parent 02c5ea0 commit c3a6ef63dd908c72530205c870686f4468b10b06 @zedshaw committed Apr 1, 2012
Showing with 18 additions and 15 deletions.
  1. +18 −15 Makefile
View
@@ -1,4 +1,4 @@
-CFLAGS=-g -O2 -Wall -Wextra -Isrc -pthread -rdynamic -DNDEBUG $(OPTFLAGS)
+CFLAGS=-g -O2 -Wall -Wextra -Isrc -rdynamic -DNDEBUG $(OPTFLAGS)
LIBS=-ldl $(OPTLIBS)
PREFIX?=/usr/local
@@ -8,8 +8,9 @@ OBJECTS=$(patsubst %.c,%.o,$(SOURCES))
TEST_SRC=$(wildcard tests/*_tests.c)
TESTS=$(patsubst %.c,%,$(TEST_SRC))
-TARGET=build/libYOUR_LIBRARY.a
+TARGET=build/liblcthw.a
+# The Target Build
all: $(TARGET) tests
dev: CFLAGS=-g -Wall -Isrc -Wall -Wextra $(OPTFLAGS)
@@ -24,27 +25,29 @@ build:
@mkdir -p build
@mkdir -p bin
-clean:
- rm -rf build $(OBJECTS) $(TESTS)
- rm -f tests/tests.log
- find . -name "*.gc*" -exec rm {} \;
- rm -rf `find . -name "*.dSYM" -print`
-
+# The Unit Tests
.PHONY: tests
+tests: CFLAGS += $(TARGET)
tests: $(TESTS)
sh ./tests/runtests.sh
-$(TESTS): %: %.c $(TARGET)
- $(CC) $(CFLAGS) -o $@ $< $(TARGET) $(LIBS)
+valgrind:
+ VALGRIND="valgrind --log-file=/tmp/valgrind-%p.log" $(MAKE)
-check:
- @echo Files with potentially dangerous functions.
- @egrep '[^_.>a-zA-Z0-9](str(n?cpy|n?cat|xfrm|n?dup|str|pbrk|tok|_)|stpn?cpy|a?sn?printf|byte_)' $(SOURCES)
+# The Cleaner
+clean:
+ rm -rf build $(OBJECTS) $(TESTS)
+ rm -f tests/tests.log
+ find . -name "*.gc*" -exec rm {} \;
+ rm -rf `find . -name "*.dSYM" -print`
+# The Install
install: all
install -d $(DESTDIR)/$(PREFIX)/lib/
install $(TARGET) $(DESTDIR)/$(PREFIX)/lib/
-valgrind:
- VALGRIND="valgrind --log-file=/tmp/valgrind-%p.log" $(MAKE)
+# The Checker
+check:
+ @echo Files with potentially dangerous functions.
+ @egrep '[^_.>a-zA-Z0-9](str(n?cpy|n?cat|xfrm|n?dup|str|pbrk|tok|_)|stpn?cpy|a?sn?printf|byte_)' $(SOURCES) || true

0 comments on commit c3a6ef6

Please sign in to comment.