-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
70 lines (55 loc) · 1.58 KB
/
Makefile
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
NETCFG_VERSION := $(shell dpkg-parsechangelog | grep ^Version: |sed 's/Version: //')
NETCFG_BUILD_DATE := $(shell date '+%Y%m%d-%H%M')
DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
CC ?= gcc
TARGETS ?= netcfg-static netcfg
LDOPTS = -ldebconfclient -ldebian-installer
CFLAGS = -pthread -W -Wall -Werror -DNDEBUG -DNETCFG_VERSION="\"$(NETCFG_VERSION)\"" -DNETCFG_BUILD_DATE="\"$(NETCFG_BUILD_DATE)\"" -I.
COMMON_OBJS = netcfg-common.o wireless.o write_interface.o ipv6.o
NETCFG_O = netcfg.o dhcp.o static.o ethtool-lite.o wpa.o wpa_ctrl.o rdnssd.o autoconfig.o
NETCFG_STATIC_O = netcfg-static.o static.o ethtool-lite.o
WIRELESS = 1
NM = 1
ifneq ($(DEB_HOST_ARCH_OS),linux)
WIRELESS = 0
NM = 0
endif
ifeq ($(DEB_HOST_ARCH),s390)
WIRELESS = 0
endif
ifeq ($(DEB_HOST_ARCH),s390x)
WIRELESS = 0
endif
ifeq ($(DEB_HOST_ARCH),sparc)
WIRELESS = 0
endif
ifneq ($(WIRELESS),0)
LDOPTS += -liw
CFLAGS += -DWIRELESS
endif
ifneq ($(NM),0)
CFLAGS += -DNM
NETCFG_O += nm-conf.o
endif
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0 -g3
else
CFLAGS += -Os -fomit-frame-pointer
endif
all: $(TARGETS)
netcfg-static: $(NETCFG_STATIC_O)
netcfg: $(NETCFG_O)
ethtool-lite: ethtool-lite-test.o
$(CC) -o $@ $<
ethtool-lite-test.o: ethtool-lite.c
$(CC) -c $(CFLAGS) -DTEST $(DEFS) $(INCS) -o $@ $<
$(TARGETS): $(COMMON_OBJS)
$(CC) -o $@ $^ $(LDOPTS)
%.o: %.c
$(CC) -c $(CFLAGS) $(DEFS) $(INCS) -o $@ $<
clean:
rm -f $(TARGETS) ethtool-lite *.o test/*.o test/run
include test/tests.mk
.PHONY: all clean
# vim:ts=8:noet