|
|
60ac66 |
-include $(PROJECT_DIR)/project/os/$(OS).mk
|
|
|
60ac66 |
|
|
|
79e62f |
# build/version.h
|
|
|
0bbcdb |
build/version.h:$(wildcard $(SOURCE_DIR)/VERSION $(SOURCE_DIR)/.git/index) dirs.tag
|
|
|
79e62f |
printf '#define VERSION "%s"\n' \
|
|
|
79e62f |
"$$(cd $(SOURCE_DIR); $(SHELL) ./tools/version.sh)" > $@
|
|
|
79e62f |
|
|
|
dd6f0e |
# alltypes.h, syscall.h
|
|
|
3a6f4c |
build/include/bits/:
|
|
|
3a6f4c |
mkdir -p $@
|
|
|
3a6f4c |
|
|
|
dd6f0e |
ALLTYPES_H = build/include/bits/alltypes.h
|
|
|
dd6f0e |
SYSCALL_H = build/include/bits/syscall.h
|
|
|
3ae283 |
|
|
|
dd6f0e |
ARCH_GEN_H = $(ALLTYPES_H) $(SYSCALL_H)
|
|
|
3ae283 |
|
|
|
dd6f0e |
ALLTYPES_DEPS = \
|
|
|
dd6f0e |
$(PORT_DIR)/arch/$(ARCH)/bits/alltypes.h.in \
|
|
|
fe59d4 |
$(ALLTYPES_SED) \
|
|
|
dd6f0e |
$(SOURCE_DIR)/include/alltypes.h.in \
|
|
|
0bc6cc |
$(SOURCE_DIR)/tools/mkalltypes.sed \
|
|
|
0bc6cc |
| build/include/bits/
|
|
|
dd6f0e |
|
|
|
0bc6cc |
$(ALLTYPES_H): $(ALLTYPES_DEPS)
|
|
|
fe59d4 |
sed -f $(ALLTYPES_SED) \
|
|
|
e9e8eb |
-f $(SOURCE_DIR)/tools/mkalltypes.sed \
|
|
|
dd6f0e |
$(PORT_DIR)/arch/$(ARCH)/bits/alltypes.h.in \
|
|
|
dd6f0e |
$(SOURCE_DIR)/include/alltypes.h.in > $@
|
|
|
dd6f0e |
|
|
|
155000 |
build/syscall_h.tag:
|
|
|
155000 |
touch $@
|
|
|
155000 |
touch $(SYSCALL_H)
|
|
|
155000 |
|
|
|
0bc6cc |
build/syscall-copy.tag: | build/include/bits/
|
|
|
155000 |
build/syscall-copy.tag: $(PORT_DIR)/arch/$(ARCH)/bits/syscall.h
|
|
|
dd6f0e |
cp $< $(SYSCALL_H)
|
|
|
155000 |
touch $@
|
|
|
dd6f0e |
|
|
|
0bc6cc |
build/syscall-gen.tag: | build/include/bits/
|
|
|
155000 |
build/syscall-gen.tag: $(PORT_DIR)/arch/$(ARCH)/bits/syscall.h.in
|
|
|
dd6f0e |
cp $< $(SYSCALL_H).tmp
|
|
|
dd6f0e |
sed -n -e 's/__NR_/SYS_/p' < $< >> $(SYSCALL_H).tmp
|
|
|
dd6f0e |
mv $(SYSCALL_H).tmp $(SYSCALL_H)
|
|
|
155000 |
touch $@
|
|
|
dd6f0e |
|
|
|
155000 |
$(SYSCALL_H): build/syscall_h.tag
|
|
|
dd6f0e |
|
|
|
dd6f0e |
|
|
|
3a6f4c |
# arch headers
|
|
|
3a6f4c |
libc_bits_h = $(sort $(wildcard $(SOURCE_DIR)/arch/generic/bits/*.h))
|
|
|
3a6f4c |
port_bits_h = $(sort $(wildcard $(PORT_DIR)/arch/$(ARCH)/bits/*.h))
|
|
|
3a6f4c |
port_substs_h = $(subst $(PORT_DIR)/arch/$(ARCH)/, \
|
|
|
3a6f4c |
$(SOURCE_DIR)/arch/generic/,\
|
|
|
3a6f4c |
$(port_bits_h))
|
|
|
3a6f4c |
|
|
|
3a6f4c |
ARCH_HEADERS = $(port_bits_h) $(filter-out $(port_substs_h), $(libc_bits_h))
|
|
|
3a6f4c |
|
|
|
c2a03c |
src_bits_h = $(subst $(SOURCE_DIR)/arch/generic/,build/include/,\
|
|
|
3a6f4c |
$(subst $(PORT_DIR)/arch/$(ARCH)/,build/include/, \
|
|
|
3a6f4c |
$(ARCH_HEADERS)))
|
|
|
3a6f4c |
|
|
|
c2a03c |
dst_bits_h = $(ARCH_GEN_H:build/include/%=$(DESTDIR)$(INCLUDEDIR)/%)
|
|
|
c2a03c |
dst_bits_h += $(src_bits_h:build/include/%=$(DESTDIR)$(INCLUDEDIR)/%)
|
|
|
3a6f4c |
|
|
|
3a6f4c |
|
|
|
3a6f4c |
# libc headers
|
|
|
3a6f4c |
src_header_dirs = $(filter %/,$(wildcard $(SOURCE_DIR)/include/*/))
|
|
|
3a6f4c |
dst_header_dirs = $(src_header_dirs:$(SOURCE_DIR)/include/%=$(DESTDIR)$(INCLUDEDIR)/%)
|
|
|
3a6f4c |
|
|
|
60ac66 |
src_c_headers_ = $(sort $(wildcard $(SOURCE_DIR)/include/*.h))
|
|
|
60ac66 |
src_c_headers_ += $(sort $(wildcard $(SOURCE_DIR)/include/*/*.h))
|
|
|
60ac66 |
src_c_headers = $(filter-out $(OS_EXCLUDE_LIBC_HEADERS), $(src_c_headers_))
|
|
|
3a6f4c |
|
|
|
3a6f4c |
dst_c_headers = $(subst $(SOURCE_DIR)/include/, \
|
|
|
3a6f4c |
$(DESTDIR)$(INCLUDEDIR)/, \
|
|
|
3a6f4c |
$(src_c_headers))
|
|
|
3a6f4c |
|
|
|
3a6f4c |
$(dst_header_dirs):
|
|
|
3a6f4c |
mkdir -p $@
|
|
|
3a6f4c |
|
|
|
c2a03c |
$(src_bits_h): build/headers.tag
|
|
|
3a6f4c |
|
|
|
3a6f4c |
$(DESTDIR)$(INCLUDEDIR)/bits/:
|
|
|
3a6f4c |
mkdir -p $@
|
|
|
3a6f4c |
|
|
|
3a6f4c |
$(DESTDIR)$(INCLUDEDIR)/bits/%.h: build/include/bits/%.h $(DESTDIR)$(INCLUDEDIR)/bits/
|
|
|
3a6f4c |
cp $< $@.tmp
|
|
|
3a6f4c |
chmod 0644 $@.tmp
|
|
|
3a6f4c |
mv $@.tmp $@
|
|
|
3a6f4c |
|
|
|
3a6f4c |
$(DESTDIR)$(INCLUDEDIR)/%.h: | $(dst_header_dirs)
|
|
|
3a6f4c |
$(DESTDIR)$(INCLUDEDIR)/%.h: $(SOURCE_DIR)/include/%.h
|
|
|
3a6f4c |
cp -p $< $@.tmp
|
|
|
3a6f4c |
chmod 0644 $@.tmp
|
|
|
3a6f4c |
mv $@.tmp $@
|
|
|
3a6f4c |
|
|
|
dd6f0e |
|
|
|
dd6f0e |
# build/include
|
|
|
3a6f4c |
build/headers.tag: | build/include/bits/
|
|
|
1c4ed1 |
build/headers.tag: build/syscall_h.tag
|
|
|
3a6f4c |
build/headers.tag: $(ARCH_HEADERS)
|
|
|
3a6f4c |
cp $(ARCH_HEADERS) build/include/bits/
|
|
|
3a6f4c |
touch $@
|
|
|
dd6f0e |
|
|
|
155000 |
headers.tag: build/headers.tag $(ARCH_GEN_H)
|
|
|
1cfd88 |
grep 'struct msghdr {' $(SOURCE_DIR)/include/sys/socket.h \
|
|
|
1cfd88 |
|| cat $(PORT_DIR)/arch/$(ARCH)/bits/socket.h.in \
|
|
|
1cfd88 |
> build/include/bits/socket.h \
|
|
|
1cfd88 |
|| cat $(PORT_DIR)/arch/$(ARCH)/bits/socket.h \
|
|
|
1cfd88 |
> build/include/bits/socket.h
|
|
|
831753 |
grep -v '^@@@' build/include/bits/ioctl.h \
|
|
|
831753 |
> build/include/bits/ioctl.h.tmp
|
|
|
c2de46 |
grep 'struct winsize' $(SOURCE_DIR)/include/sys/ioctl.h \
|
|
|
c2de46 |
|| grep '^STRUCT winsize' $(SOURCE_DIR)/include/alltypes.h.in \
|
|
|
c2de46 |
|| sed 's/^@@@//g' build/include/bits/ioctl.h \
|
|
|
c2de46 |
> build/include/bits/ioctl.h.tmp
|
|
|
831753 |
mv build/include/bits/ioctl.h.tmp build/include/bits/ioctl.h
|
|
|
155000 |
touch $@
|
|
|
155000 |
|
|
|
7fdb9d |
install-arch-headers: headers.tag $(ARCH_GEN_H) $(src_bits_h) $(dst_bits_h)
|
|
|
7fdb9d |
|
|
|
7fdb9d |
install-libc-headers: headers.tag $(dst_header_dirs) $(dst_c_headers)
|
|
|
7fdb9d |
|
|
|
7fdb9d |
install-headers: install-arch-headers install-libc-headers
|
|
|
7fdb9d |
|
|
|
dd6f0e |
clean-headers:
|
|
|
c2a03c |
rm -f $(ARCH_GEN_H)
|
|
|
3a6f4c |
rm -f $(src_bits_h)
|
|
|
dd6f0e |
rm -f $(SYSCALL_H).tmp
|
|
|
79e62f |
rm -f build/version.h
|
|
|
dd6f0e |
rmdir build/include/bits 2>/dev/null || true
|
|
|
dd6f0e |
rmdir build/include 2>/dev/null || true
|
|
|
dd6f0e |
rm -f build/headers.tag
|
|
|
155000 |
rm -f build/syscall-copy.tag
|
|
|
155000 |
rm -f build/syscall-gen.tag
|
|
|
155000 |
rm -f build/syscall_h.tag
|
|
|
155000 |
rm -f headers.tag
|
|
|
dd6f0e |
|
|
|
dd6f0e |
clean: clean-headers
|
|
|
dd6f0e |
|
|
|
dd6f0e |
.PHONY: syscall-arch
|
|
|
dd6f0e |
.PHONY: syscall-copy
|
|
|
dd6f0e |
.PHONY: syscall-gen
|
|
|
dd6f0e |
.PHONY: clean-headers
|