File: Makefile

package info (click to toggle)
canlock 2b-8
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 312 kB
  • sloc: ansic: 734; makefile: 60; sh: 2
file content (38 lines) | stat: -rwxr-xr-x 1,166 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
CFLAGS = -Iinclude $(shell dpkg-buildflags --get CFLAGS) $(shell dpkg-buildflags --get CPPFLAGS) $(shell dpkg-buildflags --get LDFLAGS)
LDFLAGS = -L. -lcanlock
CC = gcc
STATIC_LIB = libcanlock.a

all: hmactest canlocktest $(STATIC_LIB)

sha1test: t/sha1test.c $(STATIC_LIB)
	$(CC) $(CFLAGS) t/$@.c -o $@ $(LDFLAGS)

hmactest: t/hmactest.c $(STATIC_LIB)
	$(CC) $(CFLAGS) t/$@.c -o $@ $(LDFLAGS)

canlocktest: t/canlocktest.c $(STATIC_LIB)
	$(CC) $(CFLAGS) t/$@.c -o $@ $(LDFLAGS)

$(STATIC_LIB):
	cd src && make
	ln -s src/libcanlock.a libcanlock.a

clean:
	rm -f src/*.o t/*.o t/*.out *.gmon gmon.*
	cd src && make clean
	rm -f *.a canlocktest hmactest sha1test *.exe *.h lib-stamp

install: all
	cd src && make install DESTDIR=$(DESTDIR)
	install -D --mode=644 include/canlock.h $(DESTDIR)/usr/include/canlock.h
	
test: all
	@echo "hmactest: "
	@./hmactest > t/hmactest.out || echo hmm
	@diff t/hmactest.shouldbe t/hmactest.out && echo " Pass." || (echo " **FAIL**" ; exit 1)
	@echo "=-=-=-="
	@echo "canlocktest: "
	@./canlocktest > t/canlocktest.out
	@diff t/canlocktest.shouldbe t/canlocktest.out && echo " Pass." || (echo " **FAIL**" ; exit 1)
	@echo "=-=-=-="