-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.in
135 lines (109 loc) · 3.56 KB
/
Makefile.in
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#
# $Id: Makefile.in 996 2009-03-19 18:14:44Z csc $
#
# Makefile
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
datarootdir = @datarootdir@
libdir = @libdir@
mandir = @mandir@
includedir = @includedir@
top_builddir = .
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_HEADER = $(INSTALL_DATA)
CC = @CC@
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE_NAME@
VERSION = @PACKAGE_VERSION@
install_sh = @install_sh@
OPENSSL = @OPENSSL@
# compiler / preprcessor options
DEFS = @DEFS@
# no strict aliasing becauses it produce many warnings due to libev
CFLAGS = @CFLAGS@ -Wall -Wno-strict-aliasing
CPPFLAGS = -I. -I./include
CPPFLAGS += @CPPFLAGS@
CPPFLAGS += @EV_CFLAGS@
# linker options
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@ @EV_LIBS@
PFLIBS = $(LIBS) -lpfring -lm
DEPDIR = .depend
OBJDIR = .object
TARGETS = impd4e
# get all source files
SOURCE_DIR = src
SRCS = $(notdir $(wildcard $(SOURCE_DIR)/*.c))
# build all object files in a separate dir
OBJS = $(addprefix $(OBJDIR)/,$(SRCS:.c=.o))
CLEANFILES = $(TARGETS) $(DEPDIR) $(OBJDIR) *.o *.d version.h
# default target
all: $(TARGETS)
clean:
rm -rf $(CLEANFILES)
distclean:
rm -rf $(CLEANFILES) $(DHPARAMS) Makefile config.log config.status config.h
install:
@[ -d $(DESTDIR)${bindir} ] || (mkdir -p $(DESTDIR)${bindir}; chmod 755 $(DESTDIR)${bindir})
$(INSTALL_DATA) $(TARGETS) $(DESTDIR)/${bindir}/
chmod 755 $(DESTDIR)${bindir}/$(TARGETS)
uninstall:
rm -f $(DESTDIR)${bindir}/$(TARGETS)
releasetar:
@cwd=`pwd`; dir=`basename $$cwd`; name=$(PACKAGE)-`cat VERSION`; mkdir $$name; \
tar cf - *.c *.h config/ configure configure.ac config.h.in Makefile.in | (cd $$name; tar xf -);\
tar -czvf $$name.tar.gz $$name;\
rm -rf $$name
# build binary package
# to build signed package remove -us -uc
binary-pkg:
debuild -i -I -us -uc
# build source package; ready for uploading
# to build signed package remove -us -uc
source-pkg:
debuild -i -I -S -sa -us -uc
# -----------------------------------------------------------------------------
# build rules
# -----------------------------------------------------------------------------
# include rules file for each object file
-include $(addprefix $(DEPDIR)/,$(SRCS:.c=.d))
impd4e: $(OBJS)
$(CC) $(LDFLAGS) $^ $(LIBS) -o $@
# $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
impd4e_pf: $(OBJS)
$(CC) $(LDFLAGS) $^ $(PFLIBS) -o $@
# $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(PFLIBS) -o $@
# generate rules file with all dependencies for each object file
$(DEPDIR)/%.d: $(SOURCE_DIR)/%.c | $(DEPDIR)
@set -e; rm -f $@; \
$(CC) -MM -MG $(CFLAGS) $(CPPFLAGS) $(DEFS) $< -MF $@.$$$$; \
sed 's,\($*\)\.o[ :]*,$(OBJDIR)/\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
$(DEPDIR):
@mkdir -p $@
# generate each object file
$(OBJDIR)/%.o: $(SOURCE_DIR)/%.c | $(OBJDIR)
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(DEFS) $< -o $@
$(OBJDIR):
@mkdir -p $@
version.h:
@echo update version.h
@echo "/* this is a generated file do not change */" > $@
@echo \#ifndef _VERSION_H_ >> $@
@echo \#define _VERSION_H_ >> $@
-@echo \#define BUILD_VERSION \"$(shell head -1 ./debian/changelog | perl -nle 'm/\S+\s+\((\S+-\S+)\)/ and print $$1')\" >> $@
-@echo \#define BUILD_DATE \"$(shell date)\" >> $@
-@echo \#define GIT_BRANCH \"$(shell git branch | grep \* | sed 's/\* //g')\" >> $@
-@echo \#define GIT_HASH \"$(shell git log -1 --pretty=format:%H)\" >> $@
@echo \#endif >> $@