Debian Codegraph @

Makefile

raw
1 NETCFG_VERSION := $(shell dpkg-parsechangelog | grep ^Version: |sed 's/Version: //')
2 DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
3 DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
4
5 CC ?= gcc
6 TARGETS ?= netcfg-static netcfg
7
8 LDOPTS = -ldebconfclient -ldebian-installer
9 CFLAGS = -W -Wall -Werror -DNDEBUG -DNETCFG_VERSION="\"$(NETCFG_VERSION)\"" -I.
10 COMMON_OBJS = netcfg-common.o wireless.o write_interface.o ipv6.o
11 NETCFG_O = netcfg.o dhcp.o static.o ethtool-lite.o wpa.o wpa_ctrl.o rdnssd.o autoconfig.o
12 NETCFG_STATIC_O = netcfg-static.o static.o ethtool-lite.o
13
14 WIRELESS = 1
15 NM = 1
16 NETPLAN = 1
17 ifneq ($(DEB_HOST_ARCH_OS),linux)
18 WIRELESS = 0
19 NM = 0
20 NETPLAN = 0
21 endif
22 ifeq ($(DEB_HOST_ARCH),s390)
23 WIRELESS = 0
24 endif
25 ifeq ($(DEB_HOST_ARCH),s390x)
26 WIRELESS = 0
27 endif
28 ifeq ($(DEB_HOST_ARCH),sparc)
29 WIRELESS = 0
30 endif
31
32 ifneq ($(WIRELESS),0)
33 LDOPTS += -liw -lm
34 CFLAGS += -DWIRELESS
35 endif
36 ifneq ($(NM),0)
37 CFLAGS += -DNM
38 NETCFG_O += nm-conf.o
39 endif
40 ifneq ($(NETPLAN),0)
41 CFLAGS += -DNETPLAN
42 NETCFG_O += netplan-conf.o
43 endif
44
45 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
46 CFLAGS += -O0 -g3
47 else
48 CFLAGS += -Os -fomit-frame-pointer
49 endif
50
51 all: $(TARGETS)
52
53 netcfg-static: $(NETCFG_STATIC_O)
54 netcfg: $(NETCFG_O)
55
56 ethtool-lite: ethtool-lite-test.o
57 $(CC) -o $@ $<
58
59 ethtool-lite-test.o: ethtool-lite.c
60 $(CC) -c $(CFLAGS) -DTEST $(DEFS) $(INCS) -o $@ $<
61
62 $(TARGETS): $(COMMON_OBJS)
63 $(CC) -o $@ $^ $(LDOPTS)
64
65 %.o: %.c
66 $(CC) -c $(CFLAGS) $(DEFS) $(INCS) -o $@ $<
67
68 clean:
69 rm -f $(TARGETS) ethtool-lite *.o test/*.o test/run
70
71 include test/tests.mk
72
73 .PHONY: all clean
74
75 # vim:ts=8:noet