forked from Mildstone/Anacleto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommonLinux.mk
55 lines (46 loc) · 1.57 KB
/
CommonLinux.mk
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
include $(top_srcdir)/Common.mk
AM_MAKEFLAGS = -j$(MAKE_PROCESS)
CLEANFILES = $(LIBLIBS_SO) $(BINS)
MOSTLYCLEANFILES = *.mod.c *.o modules.order Module.symvers
.PHONY: modules
modules: $(MODULES:=.c) Kbuild
@ echo " --- building modules ---"; \
$(_set_export); \
$(MAKE) $(AM_MAKEFLAGS) -C ${LINUX_SRCDIR} \
CFLAGS="$(LINUX_CFLAGS)" M=$$PWD O=$$O \
srcdir=$(srcdir) builddir=$(builddir) modules
clean-local:
@ echo " --- cleaning modules ---"; \
$(_set_export); \
$(MAKE) $(AM_MAKEFLAGS) -C ${LINUX_SRCDIR} \
CFLAGS="$(LINUX_CFLAGS)" M=$$PWD O=$$O \
srcdir=$(srcdir) builddir=$(builddir) clean
.PHONY: bins
bins: $(BINS)
$(BINS):
echo " --- building $@ ---"; \
$(_set_export); \
${CROSS_COMPILE}${CC} $(DEBUG_FLAGS) $(LINUX_CFLAGS) $(srcdir)/$@_bin.c -o $@
.PHONY: libs
libs: $(LIBLIBS_SO)
LIBLIBS_SO = $(addprefix lib,$(LIBS:=.so))
$(LIBLIBS_SO): lib%.so: %_lib.c
echo " --- building $@ ---"; \
$(_set_export); \
${CROSS_COMPILE}${CC} $(DEBUG_FLAGS) $(LINUX_CFLAGS) $(srcdir)/$< -fPIC -shared -o $@
.PHONY: deploy
deploy: $(MODULES:=.ko) $(LIBLIBS_SO) $(BINS)
if WITH_DEVICE_SSHKEY
@ echo " --- deploying modules to target device: ${DEVICE_NAME} using key ---";
scp -i $(DEVICE_SSHKEY) $^ \
$(DEVICE_USER)@$(DEVICE_IP):$(DEVICE_MODULES_DIR);
else
if WITH_DEVICE_SSHPASSWD
@ echo " --- deploying modules to target device: ${DEVICE_NAME} using passwd ---";
sshpass -p ${DEVICE_PASSWD} scp $^ \
$(DEVICE_USER)@$(DEVICE_IP):$(DEVICE_MODULES_DIR);
endif
endif
.PHONY: kernelversion
kernelversion:
@$($(MAKE) -C ${LINUX_SRCDIR} --no-print-directory kernelversion)