]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | # |
2 | # Copyright (c) 2012-2018, Intel Corporation | |
3 | # | |
4 | # Redistribution and use in source and binary forms, with or without | |
5 | # modification, are permitted provided that the following conditions are met: | |
6 | # | |
7 | # * Redistributions of source code must retain the above copyright notice, | |
8 | # this list of conditions and the following disclaimer. | |
9 | # * Redistributions in binary form must reproduce the above copyright | |
10 | # notice, this list of conditions and the following disclaimer in the | |
11 | # documentation and/or other materials provided with the distribution. | |
12 | # * Neither the name of Intel Corporation nor the names of its contributors | |
13 | # may be used to endorse or promote products derived from this software | |
14 | # without specific prior written permission. | |
15 | # | |
16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
19 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE | |
20 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
22 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |
23 | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
24 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
25 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
26 | # | |
27 | ||
28 | APP := ipsec_MB_testapp | |
29 | INSTPATH ?= /usr/include/intel-ipsec-mb.h | |
30 | ||
31 | CFLAGS = -g -DLINUX -D_GNU_SOURCE \ | |
32 | -W -Wall -Wextra -Wmissing-declarations -Wpointer-arith \ | |
33 | -Wcast-qual -Wundef -Wwrite-strings \ | |
34 | -Wformat -Wformat-security \ | |
35 | -Wunreachable-code -Wmissing-noreturn -Wsign-compare -Wno-endif-labels \ | |
36 | -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition | |
37 | ||
38 | LDFLAGS = -fPIE -z noexecstack -z relro -z now | |
39 | LDLIBS = -lIPSec_MB | |
40 | ||
41 | ifeq ("$(shell test -r $(INSTPATH) && echo -n yes)","yes") | |
42 | # library installed | |
43 | CFLAGS += | |
44 | else | |
45 | # library not installed | |
46 | CFLAGS += -I../include -I../ | |
47 | LDFLAGS += -L../ | |
48 | endif | |
49 | ||
50 | ifeq ($(DEBUG),y) | |
51 | CFLAGS += -O0 -DDEBUG | |
52 | LDFLAGS += -g | |
53 | else | |
54 | CFLAGS += -O3 | |
55 | endif | |
56 | ||
9f95a23c TL |
57 | SOURCES := main.c gcm_test.c ctr_test.c customop_test.c des_test.c ccm_test.c \ |
58 | cmac_test.c utils.c hmac_sha1_test.c hmac_sha256_sha512_test.c \ | |
59 | hmac_md5_test.c aes_test.c sha_test.c | |
11fdf7f2 TL |
60 | OBJECTS := $(SOURCES:%.c=%.o) |
61 | ||
62 | all: $(APP) | |
63 | ||
64 | $(APP): $(OBJECTS) | |
65 | $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ | |
66 | ||
67 | main.o: main.c do_test.h | |
68 | gcm_test.o: gcm_test.c gcm_ctr_vectors_test.h | |
69 | ctr_test.o: ctr_test.c gcm_ctr_vectors_test.h | |
70 | des_test.o: des_test.c | |
9f95a23c TL |
71 | ccm_test.o: ccm_test.c utils.h |
72 | cmac_test.o: cmac_test.c utils.h | |
73 | hmac_sha1_test.o: hmac_sha1_test.c utils.h | |
74 | hmac_md5_test.o: hmac_md5_test.c utils.h | |
75 | hmac_sha256_sha512_test.o: hmac_sha256_sha512_test.c utils.h | |
76 | aes_test.o: aes_test.c gcm_ctr_vectors_test.h utils.h | |
11fdf7f2 | 77 | customop_test.o: customop_test.c customop_test.h |
9f95a23c TL |
78 | utils.o: utils.c utils.h |
79 | sha_test.o: sha_test.c utils.h | |
11fdf7f2 TL |
80 | |
81 | .PHONY: clean | |
82 | clean: | |
83 | -rm -f $(OBJECTS) $(APP) | |
84 | ||
85 | SOURCES_STYLE := $(foreach infile,$(SOURCES),-f $(infile)) | |
86 | CHECKPATCH?=checkpatch.pl | |
87 | .PHONY: style | |
88 | style: | |
89 | $(CHECKPATCH) --no-tree --no-signoff --emacs --no-color \ | |
90 | --ignore CODE_INDENT,INITIALISED_STATIC,LEADING_SPACE,SPLIT_STRING,\ | |
91 | UNSPECIFIED_INT,ARRAY_SIZE,BLOCK_COMMENT_STYLE,GLOBAL_INITIALISERS,\ | |
9f95a23c | 92 | AVOID_EXTERNS,COMPLEX_MACRO,USE_FUNC,CONSTANT_COMPARISON,MISSING_SPACE $(SOURCES_STYLE) |