-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile.in
More file actions
151 lines (128 loc) · 3.2 KB
/
Makefile.in
File metadata and controls
151 lines (128 loc) · 3.2 KB
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# Makefile to be included by package's makefile
#
# This file includes the rules for download, extract and patch tarballs.
# There is also rules to generate the packages, clean up the build files,
# give information and so on.
#
# Your makefile must define some variables and include this file. Then
# define the rules for building and package preparation. See the packages
# zlib, rsync and dropbear for examples.
default: all
FLOAT=hard
FPU=vfp
HOST=$(shell $(CC) -dumpmachine)
TARGET=arm-linux-musleabihf
ARCH=arm
ARM_ARCH=armv6zk
# often used workaround to recognize musl triple
SEDMUSL=sed -i -e 's/linux-uclibc/linux-musl/'
export LC_ALL=POSIX
export CFLAGS=
export CXXFLAGS=
export CC=$(TARGET)-gcc
export CXX=$(TARGET)-g++
export AR=$(TARGET)-ar
export AS=$(TARGET)-as
export LD=$(TARGET)-ld
export RANLIB=$(TARGET)-ranlib
export READELF=$(TARGET)-readelf
export STRIP=$(TARGET)-strip --strip-unneeded
ifdef PKGNAME
# default PKGPATH
ifndef PKGPATH
ifdef PKGVERSION
PKGPATH=$(PKGNAME)-$(PKGVERSION)
endif
endif
# default PKGFILE
ifndef PKGFILE
ifdef PKGPATH
ifdef PKGFEXT
PKGFILE=$(PKGPATH).tar.$(PKGFEXT)
endif
endif
endif
# default PKGNAMVER
ifndef PKGNAMVER
PKGNAMVER=$(PKGPATH)
endif
endif
# performs checksum verification in a tarball
md5sum:
ifdef PKGMD5SUM
ifdef PKGFILE
@echo "$(PKGMD5SUM) $(PKGFILE)" | md5sum -c
endif
endif
# shows package name and brief description
show:
ifdef PKGNAME
ifdef PKGDESC
@printf " %-20s%s\n" "$(PKGNAME)" "$(PKGDESC)"
endif
endif
# shows package version and download site
version:
ifdef PKGNAMVER
@printf " %-20s%s\n" "$(PKGNAMVER)" "$(PKGSITE)"
endif
# cleans generated or temporary files
clean:
@echo $(RM) -r -- $(PKGCLEAN) *.d *.tgz *.part
@$(RM) -r -- $(PKGCLEAN) *.d *.tgz *.part
# cleans build files
binclean: clean
@echo $(RM) -r -- $(PKGBCLEAN) $(PKGPATH)
@$(RM) -r -- $(PKGBCLEAN) $(PKGPATH) ...
# cleans downloaded files
downclean: binclean
@echo $(RM) -r -- $(PKGDCLEAN) $(PKGFILE)
@$(RM) -r -- $(PKGDCLEAN) $(PKGFILE)
ifdef PKGNAME
# generates a package with version and list info
%.tgz: LRPKG=$</var/lib/lrpkg
%.tgz: %.d
@mkdir -p $(LRPKG)
@printf "\
DEPENDENCIES='$(PKGDEPENDENCIES)'\n\
DESCRIPTION='$(PKGDESC)'\n\
CATEGORIES='$(PKGCATEGORIES)'\n\
VERSION='$(PKGVERSION)'\n\
BUILD='$$(date "+%F %T")'\n" > $(LRPKG)/$*.info
@touch $(LRPKG)/$*.list
@find $</ -type f -o -type l | sed "s,$</,," > $(LRPKG)/$*.list
@tar czf $@ -C $</ --owner=root --group=root -T $(LRPKG)/$*.list
@mkdir -p ../../../boot/packages
@ln -f $@ ../../../boot/packages/$@
endif
# extracts a tarball and apply a patch if any
ifdef PKGFILE
$(PKGPATH): $(PKGFILE)
@tar xvf $<
ifdef PKGPATCH
@cd $@ && patch -Np1 -i ../$(PKGPATCH)
endif
@ln -s $@ ...
@touch $@
ifdef PKGDEPENDENCIES
@$(MAKE) $(PKGDEPENDENCIES)
endif
# downloads a tarball
$(PKGFILE):
@wget -c $(PKGDOWN)$@ -O $(PKGPATH).part
@mv $(PKGPATH).part $@
@echo "$(PKGMD5SUM) $@" | md5sum -c || $(RM) -- $@
endif
$(PKGDEPENDENCIES):
@for i in $@; do \
$(MAKE) -C "../$$i"; \
done
categories:
ifdef PKGCATEGORIES
@for i in $(PKGCATEGORIES); do \
mkdir -p ../../$$i; \
ln -sf ../../Makefile ../../$$i; \
ln -sf ../all/$(PKGNAME) ../../$$i; \
done
endif
.PHONY: all default show version clean binclean downclean md5sum categories