-
Notifications
You must be signed in to change notification settings - Fork 27
/
Makefile.in
136 lines (108 loc) · 3.07 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
135
136
#
# Makefile for the faifa program and library
#
#
# Copyright (C) 2007-2009
# Xavier Carcelle <[email protected]>
# Florian Fainelli <[email protected]>
# Nicolas Thill <[email protected]>
#
# License:
# GPLv2
#
CC = @CC@
STRIP ?= $(CROSS)strip
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
INSTALL = @INSTALL@
LIBS = @LIBS@
prefix = @prefix@
exec_prefix = @exec_prefix@
sbindir = @sbindir@
mandir = @mandir@
libdir = @libdir@
datarootdir = @datarootdir@
includedir = @includedir@
OS?=$(shell uname -s | tr a-z A-Z)
APP:=faifa
GIT_REV?=$(shell git describe --exact-match 2> /dev/null || echo "`git symbolic-ref HEAD 2> /dev/null | cut -b 12-`-`git log --pretty=format:\"%h\" -1`")
ifeq ($(GIT_REV),)
GIT_REV=HEAD
endif
# Object files for the library
LIB_OBJS:=faifa.o frame.o crypto.o sha2.o
LIB_NAME:=lib$(APP).a
LIB_SHARED_SO:=lib$(APP).so
LIB_SONAME:=$(LIB_SHARED_SO).0
# Object files for the program
OBJS:= main.o
HEADERS:= faifa.h faifa_compat.h faifa_priv.h homeplug.h homeplug_av.h crypto.h device.h endian.h
# Objects for hpav_cfg
HPAV_CFG_OBJS:=sha2.o hpav_cfg.o crypto.o
SIM_OBJS:=simulator.o
SIM_LIBS:=-levent
SIM_CFLAGS:=-Wno-unused
ifeq ($(OS),DARWIN)
LDFLAGS+=-dynamiclib -Wl,-dylib_install_name -Wl,$(LIB_SONAME)
endif
LIBS:=$(LDFLAGS) $(LIBS)
ifeq ($(OS),CYGWIN_NT-5.1)
LIBS+=-lwpcap
APP:=$(APP).exe
else
CFLAGS+= -fPIC
endif
man8dir = $(mandir)/man8
# Man page
MANTYP=8
MANFIL=$(APP).8.gz
all: $(APP) $(LIB_NAME) $(LIB_SONAME) hpav_cfg simulator
hpav_cfg: $(HPAV_CFG_OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(HPAV_CFG_OBJS)
simulator: $(SIM_OBJS)
$(CC) $(CFLAGS) $(SIM_CFLAGS) $(LDFLAGS) -o $@ $(SIM_OBJS) $(SIM_LIBS)
$(APP): $(OBJS) $(HEADERS) $(LIB_SONAME)
$(CC) -D$(OS) -DGIT_REV="\"$(GIT_REV)\"" $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(LIB_SONAME)
$(LIB_NAME): $(LIB_OBJS) $(HEADERS)
$(AR) rcs $(LIB_NAME) $(LIB_OBJS)
$(LIB_SONAME): $(LIB_OBJS) $(HEADERS)
$(CC) -shared -Wl,-soname,$(LIB_SONAME) -o $(LIB_SONAME) $(LIB_OBJS) $(LIBS)
%.o: %.c $(HEADERS)
$(CC) -D$(OS) -DGIT_REV="\"$(GIT_REV)\"" $(CFLAGS) -c $<
clean:
rm -f $(APP) \
*.o \
*.a \
*.so* \
$(MANFIL)
autoclean:
-rm -f configure config.log config.status Makefile
distclean: clean autoclean
install: installman strip
$(INSTALL) -d $(DESTDIR)$(sbindir)
$(INSTALL) -m0755 $(APP) $(DESTDIR)$(sbindir)
$(INSTALL) -m0755 hpav_cfg $(DESTDIR)$(sbindir)
$(INSTALL) -d $(DESTDIR)$(libdir)
$(INSTALL) -m0644 $(LIB_SONAME) $(DESTDIR)$(libdir)
$(INSTALL) -d $(DESTDIR)$(includedir)/faifa
cp $(HEADERS) $(DESTDIR)$(includedir)/faifa
cd $(DESTDIR)$(libdir) && ln -sf $(LIB_SONAME) $(LIB_SHARED_SO)
strip: $(APP) $(LIB_SONAME)
$(STRIP) $(APP)
$(STRIP) $(LIB_SONAME)
man:
-rm -f $(MANFIL)
gzip -c -q -9v $(APP).$(MANTYP) > $(MANFIL)
installman: man
$(INSTALL) -d $(DESTDIR)$(man8dir)
$(INSTALL) -m0644 $(MANFIL) $(DESTDIR)$(man8dir)
uninstallman:
-rm -f $(DESTDIR)$(man8dir)/$(MANFIL)
uninstall: uninstallman
-rm -f $(DESTDIR)$(sbindir)/$(APP)
-rm -f $(DESTDIR)$(sbindir)/hpav_cfg
-rm -f $(DESTDIR)$(libdir)/$(LIB_SONAME)
-rm -f $(DESTDIR)$(libdir)/$(LIB_SHARED_SO)
-rm -rf $(DESTDIR)$(includedir)/faifa
.PHONY:
clean