mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Refactor Sortix build system and de-autoconf mxmpp.
This commit is contained in:
parent
0c7d1486b5
commit
7eb9e3c33f
28 changed files with 689 additions and 4455 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -7,4 +7,6 @@
|
||||||
libmaxsi
|
libmaxsi
|
||||||
builds
|
builds
|
||||||
sysroot
|
sysroot
|
||||||
|
sysroot-overlay
|
||||||
initrd
|
initrd
|
||||||
|
release
|
||||||
|
|
376
Makefile
376
Makefile
|
@ -1,196 +1,318 @@
|
||||||
|
SOFTWARE_MEANT_FOR_SORTIX=1
|
||||||
|
MAKEFILE_NOT_MEANT_FOR_SORTIX=1
|
||||||
include compiler.mak
|
include compiler.mak
|
||||||
include version.mak
|
include version.mak
|
||||||
|
|
||||||
ifneq ($(BUILD_LIBC),0)
|
MODULES=libc dispd games utils bench sortix
|
||||||
MODULES:=$(MODULES) libc
|
|
||||||
endif
|
|
||||||
ALLMODULES:=$(ALLMODULES) libc
|
|
||||||
|
|
||||||
ifneq ($(BUILD_DISPD),0)
|
|
||||||
MODULES:=$(MODULES) dispd
|
|
||||||
endif
|
|
||||||
ALLMODULES:=$(ALLMODULES) dispd
|
|
||||||
|
|
||||||
ifneq ($(BUILD_GAMES),0)
|
|
||||||
MODULES:=$(MODULES) games
|
|
||||||
endif
|
|
||||||
ALLMODULES:=$(ALLMODULES) games
|
|
||||||
|
|
||||||
ifneq ($(BUILD_MKINITRD),0)
|
|
||||||
MODULES:=$(MODULES) mkinitrd
|
|
||||||
endif
|
|
||||||
ALLMODULES:=$(ALLMODULES) mkinitrd
|
|
||||||
|
|
||||||
ifneq ($(BUILD_UTILS),0)
|
|
||||||
MODULES:=$(MODULES) utils
|
|
||||||
endif
|
|
||||||
ALLMODULES:=$(ALLMODULES) utils
|
|
||||||
|
|
||||||
ifneq ($(BUILD_BENCH),0)
|
|
||||||
MODULES:=$(MODULES) bench
|
|
||||||
endif
|
|
||||||
ALLMODULES:=$(ALLMODULES) bench
|
|
||||||
|
|
||||||
ifneq ($(BUILD_KERNEL),0)
|
|
||||||
MODULES:=$(MODULES) sortix
|
|
||||||
endif
|
|
||||||
ALLMODULES:=$(ALLMODULES) sortix
|
|
||||||
|
|
||||||
ifndef SYSROOT
|
ifndef SYSROOT
|
||||||
SYSROOT:=$(shell pwd)/sysroot
|
SYSROOT:=$(shell pwd)/sysroot
|
||||||
MFLAGS:=$(MFLAGS) SYSROOT=$(SYSROOT)
|
SUBMAKE_OPTIONS:=$(SUBMAKE_OPTIONS) "SYSROOT=$(SYSROOT)"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef PREFIXNAME
|
ifndef SYSROOT_OVERLAY
|
||||||
PREFIXNAME:=/
|
SYSROOT_OVERLAY:=$(shell pwd)/sysroot-overlay
|
||||||
MFLAGS:=$(MFLAGS) PREFIXNAME=$(PREFIXNAME)
|
SUBMAKE_OPTIONS:=$(SUBMAKE_OPTIONS) "SYSROOT_OVERLAY=$(SYSROOT_OVERLAY)"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
SORTIX_BUILDS_DIR?=builds
|
||||||
|
SORTIX_RELEASE_DIR?=release
|
||||||
|
|
||||||
include dirs.mak
|
include dirs.mak
|
||||||
|
|
||||||
DEBNAME:=sortix_$(VERSION)_$(CPU)
|
BUILD_NAME:=sortix_$(VERSION)_$(MACHINE)
|
||||||
DEBSRCNAME:=sortix_$(VERSION)
|
DEBNAME:=sortix_$(VERSION)_$(MACHINE)
|
||||||
DEBDIR:=builds/$(DEBNAME)
|
|
||||||
DEBSRCDIR:=builds/$(DEBSRCNAME)-src
|
|
||||||
DEBFILE:=builds/$(DEBNAME).deb
|
|
||||||
PACKAGENAME:=sortix
|
|
||||||
ISODIR:=builds/$(DEBNAME)-iso
|
|
||||||
ISOFILE:=builds/$(DEBNAME).iso
|
|
||||||
INITRD=$(INSTALLBOOTDIR)/$(HOST)/sortix.initrd
|
|
||||||
|
|
||||||
MFLAGS:=$(MFLAGS) VERSION=$(VERSION)
|
INITRD:=$(SORTIX_BUILDS_DIR)/$(BUILD_NAME).initrd
|
||||||
|
|
||||||
all: $(INITRD)
|
SUBMAKE_OPTIONS:=$(SUBMAKE_OPTIONS) VERSION=$(VERSION) PREFIX= EXEC_PREFIX=/$(HOST)
|
||||||
|
|
||||||
.PHONY: all suball sysroot-base-headers sysroot-fsh clean distclean \
|
.PHONY: all
|
||||||
everything everything-all-archs all-archs linecount install uninstall \
|
all: sysroot
|
||||||
deb debfile debsource iso run-virtualbox run-virtualbox-debug \
|
|
||||||
clean-builds clean-sysroot
|
|
||||||
|
|
||||||
suball: sysroot-base-headers
|
.PHONY: build-tools
|
||||||
(for D in $(MODULES); do ($(MAKE) all $(MFLAGS) --directory $$D && $(MAKE) install $(MFLAGS) --directory $$D) || exit $$?; done)
|
build-tools:
|
||||||
|
$(MAKE) -C mkinitrd
|
||||||
|
$(MAKE) -C mxmpp
|
||||||
|
|
||||||
sysroot-base-headers: sysroot-fsh
|
.PHONY: install-build-tools
|
||||||
(for D in libc sortix; do ($(MAKE) install-headers $(MFLAGS) --directory $$D) || exit $$?; done)
|
install-build-tools:
|
||||||
|
$(MAKE) -C mkinitrd install
|
||||||
|
$(MAKE) -C mxmpp install
|
||||||
|
|
||||||
|
.PHONY: sysroot-fsh
|
||||||
sysroot-fsh:
|
sysroot-fsh:
|
||||||
mkdir -p "$(SYSROOT)"
|
mkdir -p "$(SYSROOT)"
|
||||||
for DIRNAME in bin boot lib include; do (\
|
for DIRNAME in boot etc include; do (\
|
||||||
mkdir -p "$(SYSROOT)/$$DIRNAME" &&\
|
mkdir -p "$(SYSROOT)/$$DIRNAME" &&\
|
||||||
mkdir -p "$(SYSROOT)/$$DIRNAME/$(HOST)" \
|
mkdir -p "$(SYSROOT)/$$DIRNAME/$(HOST)" \
|
||||||
) || exit $$?; done;
|
) || exit $$?; done;
|
||||||
if [ ! -e "$(SYSROOT)/usr" ]; then ln -s . "$(SYSROOT)/usr"; fi
|
mkdir -p "$(SYSROOT)/$(HOST)"
|
||||||
|
for DIRNAME in bin lib; do (\
|
||||||
|
mkdir -p "$(SYSROOT)/$(HOST)/$$DIRNAME" \
|
||||||
|
) || exit $$?; done;
|
||||||
|
mkdir -p "$(SYSROOT)/etc/skel"
|
||||||
|
mkdir -p "$(SYSROOT)/home"
|
||||||
|
mkdir -p "$(SYSROOT)/mnt"
|
||||||
|
mkdir -p "$(SYSROOT)/share"
|
||||||
|
mkdir -p "$(SYSROOT)/src"
|
||||||
|
mkdir -p "$(SYSROOT)/tmp"
|
||||||
|
|
||||||
clean:
|
.PHONY: sysroot-base-headers
|
||||||
rm -f "$(INITRD)"
|
sysroot-base-headers: sysroot-fsh
|
||||||
rm -f sortix/sortix.initrd # Backwards compatibility, not needed for newer builds.
|
(for D in libc sortix; do ($(MAKE) -C $$D install-headers $(SUBMAKE_OPTIONS) DESTDIR="$(SYSROOT)") || exit $$?; done)
|
||||||
rm -f initrd/* # Backwards compatibility, not needed for newer builds.
|
|
||||||
(for D in $(ALLMODULES); do $(MAKE) clean $(MFLAGS) --directory $$D || exit $$?; done)
|
|
||||||
|
|
||||||
|
.PHONY: sysroot-system
|
||||||
|
sysroot-system: sysroot-fsh sysroot-base-headers
|
||||||
|
(for D in $(MODULES); do ($(MAKE) -C $$D $(SUBMAKE_OPTIONS) && $(MAKE) -C $$D install $(SUBMAKE_OPTIONS) DESTDIR="$(SYSROOT)") || exit $$?; done)
|
||||||
|
|
||||||
|
.PHONY: sysroot-source
|
||||||
|
sysroot-source: sysroot-fsh
|
||||||
|
cp compiler.mak -t "$(SYSROOT)/src"
|
||||||
|
cp dirs.mak -t "$(SYSROOT)/src"
|
||||||
|
cp platform.mak -t "$(SYSROOT)/src"
|
||||||
|
cp version.mak -t "$(SYSROOT)/src"
|
||||||
|
cp README -t "$(SYSROOT)/src"
|
||||||
|
(for D in $(MODULES); do (cp -LR $$D -t "$(SYSROOT)/src" && $(MAKE) -C "$(SYSROOT)/src/$$D" clean) || exit $$?; done)
|
||||||
|
|
||||||
|
.PHONY: sysroot-overlay
|
||||||
|
sysroot-overlay: sysroot-fsh sysroot-system
|
||||||
|
! [ -d "$(SYSROOT_OVERLAY)" ] || \
|
||||||
|
cp -R --preserve=mode,timestamp,links "$(SYSROOT_OVERLAY)" -T "$(SYSROOT)"
|
||||||
|
|
||||||
|
.PHONY: sysroot-user-skel
|
||||||
|
sysroot-user-skel: sysroot-fsh sysroot-system sysroot-overlay
|
||||||
|
|
||||||
|
.PHONY: sysroot-home-directory
|
||||||
|
sysroot-home-directory: sysroot-fsh sysroot-system sysroot-overlay sysroot-user-skel
|
||||||
|
mkdir -p "$(SYSROOT)/root"
|
||||||
|
cp -R "$(SYSROOT)/etc/skel" -T "$(SYSROOT)/root"
|
||||||
|
|
||||||
|
.PHONY: sysroot
|
||||||
|
sysroot: sysroot-system sysroot-source sysroot-overlay sysroot-home-directory
|
||||||
|
|
||||||
|
.PHONY: clean-core
|
||||||
|
clean-core:
|
||||||
|
(for D in $(MODULES); do $(MAKE) clean $(SUBMAKE_OPTIONS) --directory $$D || exit $$?; done)
|
||||||
|
|
||||||
|
.PHONY: clean-builds
|
||||||
clean-builds:
|
clean-builds:
|
||||||
rm -rf builds/
|
rm -rf "$(SORTIX_BUILDS_DIR)"
|
||||||
|
rm -f sortix.initrd
|
||||||
rm -f sortix.iso
|
rm -f sortix.iso
|
||||||
|
rm -f sortix.iso.xz
|
||||||
|
|
||||||
|
.PHONY: clean-release
|
||||||
|
clean-release:
|
||||||
|
rm -rf "$(SORTIX_RELEASE_DIR)"
|
||||||
|
|
||||||
|
.PHONY: clean-sysroot
|
||||||
clean-sysroot:
|
clean-sysroot:
|
||||||
rm -rf "$(SYSROOT)"
|
rm -rf "$(SYSROOT)"
|
||||||
|
|
||||||
distclean: clean clean-builds clean-sysroot
|
.PHONY: clean
|
||||||
|
clean: clean-core
|
||||||
|
|
||||||
everything: all deb iso
|
.PHONY: mostlyclean
|
||||||
|
mostlyclean: clean-core clean-builds clean-release clean-sysroot
|
||||||
|
|
||||||
everything-all-archs:
|
.PHONY: distclean
|
||||||
$(MAKE) clean $(MFLAGS)
|
distclean: clean-core clean-builds clean-release clean-sysroot
|
||||||
$(MAKE) everything $(MFLAGS) HOST=i486-sortix
|
|
||||||
$(MAKE) clean $(MFLAGS)
|
|
||||||
$(MAKE) everything $(MFLAGS) HOST=x86_64-sortix
|
|
||||||
|
|
||||||
|
.PHONY: most-things
|
||||||
|
most-things: sysroot initrd deb tar iso
|
||||||
|
|
||||||
|
.PHONY: everything
|
||||||
|
everything: most-things iso.xz
|
||||||
|
|
||||||
|
# Targets that build multiple architectures.
|
||||||
|
|
||||||
|
.PHONY: all-archs
|
||||||
all-archs:
|
all-archs:
|
||||||
$(MAKE) clean $(MFLAGS)
|
$(MAKE) clean
|
||||||
$(MAKE) all $(MFLAGS) HOST=i486-sortix
|
$(MAKE) all HOST=i486-sortix
|
||||||
$(MAKE) clean $(MFLAGS)
|
$(MAKE) clean
|
||||||
$(MAKE) all $(MFLAGS) HOST=x86_64-sortix
|
$(MAKE) all HOST=x86_64-sortix
|
||||||
|
|
||||||
# Initializing RamDisk
|
.PHONY: most-things-all-archs
|
||||||
$(INITRD): suball
|
most-things-all-archs:
|
||||||
echo > "$(INITRD).filter"
|
$(MAKE) clean
|
||||||
mkinitrd/mkinitrd --filter "$(INITRD).filter" "$(SYSROOT)/bin/$(HOST)" -o "$(INITRD)"
|
$(MAKE) most-things HOST=i486-sortix
|
||||||
|
$(MAKE) clean
|
||||||
|
$(MAKE) most-things HOST=x86_64-sortix
|
||||||
|
|
||||||
# Statistics
|
.PHONY: everything-all-archs
|
||||||
linecount:
|
everything-all-archs:
|
||||||
wc -l `find | grep -E '\.h$$|\.c$$|\.cpp$$|\.s$$|\.asm$$|Makefile$$' | grep -v sysroot` | sort -n
|
$(MAKE) clean
|
||||||
|
$(MAKE) everything HOST=i486-sortix
|
||||||
|
$(MAKE) clean
|
||||||
|
$(MAKE) everything HOST=x86_64-sortix
|
||||||
|
|
||||||
|
.PHONY: release-all-archs
|
||||||
|
release-all-archs:
|
||||||
|
$(MAKE) clean
|
||||||
|
$(MAKE) release HOST=i486-sortix
|
||||||
|
$(MAKE) clean
|
||||||
|
$(MAKE) release HOST=x86_64-sortix
|
||||||
|
|
||||||
|
# Initial ramdisk
|
||||||
|
|
||||||
|
$(INITRD): sysroot
|
||||||
|
mkdir -p `dirname $(INITRD)`
|
||||||
|
echo -n > $(INITRD).filter
|
||||||
|
if ! which mkinitrd; then echo You need to install mkinitrd; fi
|
||||||
|
mkinitrd --filter $(INITRD).filter "$(SYSROOT)/$(HOST)/bin" -o $(INITRD)
|
||||||
|
rm -f $(INITRD).filter
|
||||||
|
|
||||||
|
.PHONY: initrd
|
||||||
|
initrd: $(INITRD)
|
||||||
|
|
||||||
|
sortix.initrd: $(INITRD)
|
||||||
|
cp $(INITRD) sortix.initrd
|
||||||
|
|
||||||
# Local machine
|
# Local machine
|
||||||
|
|
||||||
install: all
|
.PHONY: install
|
||||||
cp sortix/sortix.bin /boot
|
install: sysroot initrd
|
||||||
cp $(INITRD) /boot
|
cp "$(SYSROOT)/boot/$(HOST)/sortix.bin" /boot/sortix.initrd
|
||||||
|
cp $(INITRD) /boot/sortix.initrd
|
||||||
cp debsrc/etc/grub.d/42_sortix /etc/grub.d/42_sortix
|
cp debsrc/etc/grub.d/42_sortix /etc/grub.d/42_sortix
|
||||||
chmod +x /etc/grub.d/42_sortix
|
chmod +x /etc/grub.d/42_sortix
|
||||||
update-grub
|
update-grub
|
||||||
|
|
||||||
|
.PHONY: uninstall
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f /boot/sortix.bin
|
rm -f /boot/sortix.bin
|
||||||
|
rm -f /boot/sortix.initrd
|
||||||
rm -f /etc/grub.d/42_sortix
|
rm -f /etc/grub.d/42_sortix
|
||||||
|
|
||||||
# Packaging
|
# Packaging
|
||||||
|
|
||||||
deb: debfile debsource
|
$(SORTIX_BUILDS_DIR):
|
||||||
|
mkdir -p $(SORTIX_BUILDS_DIR)
|
||||||
|
|
||||||
debfile: all
|
$(SORTIX_BUILDS_DIR)/$(BUILD_NAME).tar.xz: sysroot $(INITRD) $(SORTIX_BUILDS_DIR)
|
||||||
rm -rf $(DEBDIR)
|
rm -rf $(SORTIX_BUILDS_DIR)/tardir
|
||||||
mkdir -p $(DEBDIR)
|
mkdir -p $(SORTIX_BUILDS_DIR)/tardir
|
||||||
mkdir -p $(DEBDIR)/boot
|
mkdir -p $(SORTIX_BUILDS_DIR)/tardir/boot
|
||||||
cp sortix/sortix.bin $(DEBDIR)/boot
|
cp "$(SYSROOT)/boot/$(HOST)/sortix.bin" $(SORTIX_BUILDS_DIR)/tardir/boot/sortix.bin
|
||||||
cp $(INITRD) $(DEBDIR)/boot
|
cp $(INITRD) $(SORTIX_BUILDS_DIR)/tardir/boot/sortix.initrd
|
||||||
expr \( `stat --printf="%s" $(DEBDIR)/boot/sortix.bin` \
|
cp -R debsrc -T $(SORTIX_BUILDS_DIR)/tardir
|
||||||
+ `stat --printf="%s" $(DEBDIR)/boot/sortix.initrd` \
|
rm -rf $(SORTIX_BUILDS_DIR)/tardir/DEBIAN
|
||||||
+ 1023 \) / 1024 > $(DEBDIR)/boot/deb.size
|
tar --create --xz --file $(SORTIX_BUILDS_DIR)/$(BUILD_NAME).tar.xz -C $(SORTIX_BUILDS_DIR)/tardir `ls $(SORTIX_BUILDS_DIR)/tardir`
|
||||||
cp -r debsrc/. $(DEBDIR)
|
rm -rf $(SORTIX_BUILDS_DIR)/tardir
|
||||||
mkdir -p $(DEBDIR)/boot
|
|
||||||
SIZE=`cat $(DEBDIR)/boot/deb.size`; \
|
.PHONY: tar
|
||||||
|
tar: $(SORTIX_BUILDS_DIR)/$(BUILD_NAME).tar.xz
|
||||||
|
|
||||||
|
$(SORTIX_BUILDS_DIR)/$(DEBNAME).deb: sysroot $(INITRD) $(SORTIX_BUILDS_DIR)
|
||||||
|
rm -rf $(SORTIX_BUILDS_DIR)/$(DEBNAME)
|
||||||
|
mkdir -p $(SORTIX_BUILDS_DIR)/$(DEBNAME)
|
||||||
|
mkdir -p $(SORTIX_BUILDS_DIR)/$(DEBNAME)/boot
|
||||||
|
cp "$(SYSROOT)/boot/$(HOST)/sortix.bin" $(SORTIX_BUILDS_DIR)/$(DEBNAME)/boot/sortix.bin
|
||||||
|
cp $(INITRD) $(SORTIX_BUILDS_DIR)/$(DEBNAME)/boot/sortix.initrd
|
||||||
|
expr \( `stat --printf="%s" $(SORTIX_BUILDS_DIR)/$(DEBNAME)/boot/sortix.bin` \
|
||||||
|
+ `stat --printf="%s" $(SORTIX_BUILDS_DIR)/$(DEBNAME)/boot/sortix.initrd` \
|
||||||
|
+ 1023 \) / 1024 > $(SORTIX_BUILDS_DIR)/$(DEBNAME)/boot/deb.size
|
||||||
|
cp -R debsrc -T $(SORTIX_BUILDS_DIR)/$(DEBNAME)
|
||||||
|
SIZE=`cat $(SORTIX_BUILDS_DIR)/$(DEBNAME)/boot/deb.size`; \
|
||||||
cat debsrc/DEBIAN/control | \
|
cat debsrc/DEBIAN/control | \
|
||||||
sed "s/SORTIX_PACKAGE_NAME/$(PACKAGENAME)/g" | \
|
sed "s/SORTIX_PACKAGE_NAME/sortix/g" | \
|
||||||
sed "s/SORTIX_VERSION/$(VERSION)/g" | \
|
sed "s/SORTIX_VERSION/$(VERSION)/g" | \
|
||||||
sed "s/SORTIX_ARCH/all/g" | \
|
sed "s/SORTIX_ARCH/all/g" | \
|
||||||
sed "s/SORTIX_SIZE/$$SIZE/g" | \
|
sed "s/SORTIX_SIZE/$$SIZE/g" | \
|
||||||
cat > $(DEBDIR)/DEBIAN/control
|
cat > $(SORTIX_BUILDS_DIR)/$(DEBNAME)/DEBIAN/control
|
||||||
rm $(DEBDIR)/boot/deb.size
|
rm $(SORTIX_BUILDS_DIR)/$(DEBNAME)/boot/deb.size
|
||||||
dpkg --build $(DEBDIR) $(DEBFILE)
|
dpkg --build $(SORTIX_BUILDS_DIR)/$(DEBNAME) $(SORTIX_BUILDS_DIR)/$(DEBNAME).deb
|
||||||
rm -rf $(DEBDIR)/DEBIAN
|
rm -rf $(SORTIX_BUILDS_DIR)/$(DEBNAME)/DEBIAN
|
||||||
(cd builds/$(DEBNAME) && tar cfz ../$(DEBNAME).tar.gz `ls`)
|
rm -rf $(SORTIX_BUILDS_DIR)/$(DEBNAME)
|
||||||
rm -rf $(DEBDIR)
|
|
||||||
|
|
||||||
debsource: all
|
.PHONY: deb
|
||||||
rm -rf $(DEBSRCDIR)
|
deb: $(SORTIX_BUILDS_DIR)/$(DEBNAME).deb
|
||||||
mkdir -p $(DEBSRCDIR)
|
|
||||||
for D in `ls | grep -v builds | grep -v sysroot`; do cp -r $$D $(DEBSRCDIR); done
|
|
||||||
(cd $(DEBSRCDIR) && make distclean SYSROOT=$(shell pwd)/$(DEBSRCDIR)/sysroot)
|
|
||||||
rm -rf $(DEBSRCDIR)/sysroot
|
|
||||||
(cd builds && tar cfz $(DEBSRCNAME)-src.tar.gz $(DEBSRCNAME)-src)
|
|
||||||
rm -rf $(DEBSRCDIR)
|
|
||||||
|
|
||||||
# Bootable images
|
# Bootable images
|
||||||
|
|
||||||
$(ISOFILE): all debsource
|
$(SORTIX_BUILDS_DIR)/$(BUILD_NAME).iso: sysroot $(INITRD) $(SORTIX_BUILDS_DIR)
|
||||||
rm -rf $(ISODIR)
|
rm -rf $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
|
||||||
mkdir -p builds
|
mkdir -p $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
|
||||||
mkdir -p $(ISODIR)
|
cp -R isosrc -T $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
|
||||||
cp -r isosrc/. $(ISODIR)
|
cp "$(SYSROOT)/boot/$(HOST)/sortix.bin" $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/sortix.bin
|
||||||
cp sortix/sortix.bin $(ISODIR)/boot
|
cp $(INITRD) $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/sortix.initrd
|
||||||
cp $(INITRD) $(ISODIR)/boot/sortix.initrd
|
grub-mkrescue -o $(SORTIX_BUILDS_DIR)/$(BUILD_NAME).iso $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
|
||||||
cp builds/$(DEBSRCNAME)-src.tar.gz $(ISODIR)
|
rm -rf $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
|
||||||
grub-mkrescue -o $(ISOFILE) $(ISODIR)
|
|
||||||
rm -rf $(ISODIR)
|
|
||||||
|
|
||||||
iso: $(ISOFILE)
|
$(SORTIX_BUILDS_DIR)/$(BUILD_NAME).iso.xz: $(SORTIX_BUILDS_DIR)/$(BUILD_NAME).iso $(SORTIX_BUILDS_DIR)
|
||||||
|
xz -c $< > $@
|
||||||
|
|
||||||
sortix.iso: iso
|
.PHONY: iso
|
||||||
cp $(ISOFILE) $@
|
iso: $(SORTIX_BUILDS_DIR)/$(BUILD_NAME).iso
|
||||||
|
|
||||||
|
.PHONY: iso.xz
|
||||||
|
iso.xz: $(SORTIX_BUILDS_DIR)/$(BUILD_NAME).iso.xz
|
||||||
|
|
||||||
|
sortix.iso: $(SORTIX_BUILDS_DIR)/$(BUILD_NAME).iso
|
||||||
|
cp $(SORTIX_BUILDS_DIR)/$(BUILD_NAME).iso $@
|
||||||
|
|
||||||
|
sortix.iso.xz: $(SORTIX_BUILDS_DIR)/$(BUILD_NAME).iso.xz
|
||||||
|
cp $(SORTIX_BUILDS_DIR)/$(BUILD_NAME).iso.xz $@
|
||||||
|
|
||||||
|
# Release
|
||||||
|
|
||||||
|
$(SORTIX_RELEASE_DIR):
|
||||||
|
mkdir -p $@
|
||||||
|
|
||||||
|
$(SORTIX_RELEASE_DIR)/$(VERSION): $(SORTIX_RELEASE_DIR)
|
||||||
|
mkdir -p $@
|
||||||
|
|
||||||
|
$(SORTIX_RELEASE_DIR)/$(VERSION)/builds: $(SORTIX_RELEASE_DIR)/$(VERSION)
|
||||||
|
mkdir -p $@
|
||||||
|
|
||||||
|
$(SORTIX_RELEASE_DIR)/$(VERSION)/builds/$(BUILD_NAME).iso.xz: $(SORTIX_BUILDS_DIR)/$(BUILD_NAME).iso.xz $(SORTIX_RELEASE_DIR)/$(VERSION)/builds
|
||||||
|
cp $< $@
|
||||||
|
|
||||||
|
.PHONY: release-iso.xz
|
||||||
|
release-iso.xz: $(SORTIX_RELEASE_DIR)/$(VERSION)/builds/$(BUILD_NAME).iso.xz
|
||||||
|
|
||||||
|
$(SORTIX_RELEASE_DIR)/$(VERSION)/builds/$(DEBNAME).deb: $(SORTIX_BUILDS_DIR)/$(DEBNAME).deb $(SORTIX_RELEASE_DIR)/$(VERSION)/builds
|
||||||
|
cp $< $@
|
||||||
|
|
||||||
|
.PHONY: release-deb
|
||||||
|
release-deb: $(SORTIX_RELEASE_DIR)/$(VERSION)/builds/$(DEBNAME).deb
|
||||||
|
|
||||||
|
$(SORTIX_RELEASE_DIR)/$(VERSION)/builds/$(BUILD_NAME).tar.xz: $(SORTIX_BUILDS_DIR)/$(BUILD_NAME).tar.xz $(SORTIX_RELEASE_DIR)/$(VERSION)/builds
|
||||||
|
cp $< $@
|
||||||
|
|
||||||
|
.PHONY: release-tar
|
||||||
|
release-tar: $(SORTIX_RELEASE_DIR)/$(VERSION)/builds/$(BUILD_NAME).tar.xz
|
||||||
|
|
||||||
|
.PHONY: release-builds
|
||||||
|
release-builds: release-iso.xz release-deb release-tar
|
||||||
|
|
||||||
|
$(SORTIX_RELEASE_DIR)/$(VERSION)/README: README $(SORTIX_RELEASE_DIR)/$(VERSION)
|
||||||
|
cp $< $@
|
||||||
|
|
||||||
|
.PHONY: release-readme
|
||||||
|
release-readme: $(SORTIX_RELEASE_DIR)/$(VERSION)/README
|
||||||
|
|
||||||
|
.PHONY: release-arch
|
||||||
|
release-arch: release-builds release-readme
|
||||||
|
|
||||||
|
.PHONY: release-shared
|
||||||
|
release-shared: release-readme
|
||||||
|
|
||||||
|
.PHONY: release
|
||||||
|
release: release-arch release-shared
|
||||||
|
|
||||||
# Virtualization
|
# Virtualization
|
||||||
|
.PHONY: run-virtualbox
|
||||||
run-virtualbox: sortix.iso
|
run-virtualbox: sortix.iso
|
||||||
virtualbox --startvm sortix
|
virtualbox --startvm sortix
|
||||||
|
|
||||||
|
.PHONY: run-virtualbox-debug
|
||||||
run-virtualbox-debug: sortix.iso
|
run-virtualbox-debug: sortix.iso
|
||||||
virtualbox --debug --start-running --startvm sortix
|
virtualbox --debug --start-running --startvm sortix
|
||||||
|
|
||||||
|
# Statistics
|
||||||
|
.PHONY: linecount
|
||||||
|
linecount:
|
||||||
|
wc -l `find | grep -E '\.h$$|\.h\+\+$$|\.c$$|\.cpp$$|\.c\+\+$$|\.s$$|\.S$$|\.asm$$|Makefile$$' | grep -v sysroot | grep -v sysroot-overlay` | sort -n
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
|
SOFTWARE_MEANT_FOR_SORTIX=1
|
||||||
include ../compiler.mak
|
include ../compiler.mak
|
||||||
include ../version.mak
|
include ../version.mak
|
||||||
include ../dirs.mak
|
include ../dirs.mak
|
||||||
|
|
||||||
ifndef OPTLEVEL
|
ifndef OPTLEVEL
|
||||||
OPTLEVEL=-O2
|
OPTLEVEL=-g -O2
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef CXXFLAGS
|
ifndef CXXFLAGS
|
||||||
|
@ -16,24 +17,21 @@ BINARIES:=\
|
||||||
benchsyscall \
|
benchsyscall \
|
||||||
benchctxswitch \
|
benchctxswitch \
|
||||||
|
|
||||||
|
INSTALLBINARIES:=$(addprefix $(DESTDIR)$(BINDIR)/,$(BINARIES))
|
||||||
|
|
||||||
all: $(BINARIES)
|
all: $(BINARIES)
|
||||||
|
|
||||||
.PHONY: all install uninstall clean
|
.PHONY: all install uninstall clean
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
mkdir -p $(INSTALLBINDIR)/$(HOST)
|
mkdir -p $(DESTDIR)$(BINDIR)
|
||||||
install $(BINARIES) $(INSTALLBINDIR)/$(HOST)
|
install $(BINARIES) $(DESTDIR)$(BINDIR)
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
for FILE in $(INSTALLBINDIR); do \
|
rm -f $(INSTALLBINARIES)
|
||||||
rm -f $(INSTALLBINDIR)/$(HOST)/$$FILE; \
|
|
||||||
done
|
|
||||||
|
|
||||||
%: %.cpp
|
%: %.cpp
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
$(CXX) -std=gnu++11 $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
||||||
|
|
||||||
sh: mxsh
|
|
||||||
cp $< $@
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(BINARIES) *.o
|
rm -f $(BINARIES) *.o
|
||||||
|
|
111
compiler.mak
111
compiler.mak
|
@ -1,66 +1,113 @@
|
||||||
ifndef BITS
|
COMPILER_MAK_DIR:=$(dir $(lastword $(MAKEFILE_LIST)))
|
||||||
BITS:=$(shell getconf LONG_BIT)
|
include $(COMPILER_MAK_DIR)/platform.mak
|
||||||
|
|
||||||
|
# Warn if default target is used and the software shouldn't be built under Sortix.
|
||||||
|
ifeq ($(BUILD_IS_SORTIX),1)
|
||||||
|
ifeq ($(MAKEFILE_NOT_MEANT_FOR_SORTIX), 1)
|
||||||
|
makefile_not_meant_for_sortix:
|
||||||
|
@echo This makefile isn\'t meant to work under Sortix
|
||||||
|
@exit 1
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef HOST
|
# Warn if default target is used and the software should be built under Sortix.
|
||||||
ifeq ($(BITS),64)
|
ifeq ($(BUILD_IS_SORTIX),0)
|
||||||
HOST:=x86_64-sortix
|
ifeq ($(MAKEFILE_MEANT_FOR_SORTIX), 1)
|
||||||
else
|
makefile_meant_for_sortix:
|
||||||
HOST:=i486-sortix
|
@echo This makefile is meant to work under Sortix, not $(BUILD)
|
||||||
|
@exit 1
|
||||||
endif
|
endif
|
||||||
MFLAGS:=$(MFLAGS) HOST=$(HOST)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Warn if default target is used and the software shouldn't be built for Sortix.
|
||||||
|
ifeq ($(HOST_IS_SORTIX),1)
|
||||||
|
ifeq ($(SOFTWARE_NOT_MEANT_FOR_SORTIX), 1)
|
||||||
|
software_not_meant_for_sortix:
|
||||||
|
@echo This software isn\'t meant to work under Sortix
|
||||||
|
@exit 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Warn if default target is used and the software should be built for Sortix.
|
||||||
|
ifeq ($(HOST_IS_SORTIX),0)
|
||||||
|
ifeq ($(SOFTWARE_MEANT_FOR_SORTIX), 1)
|
||||||
|
software_meant_for_sortix:
|
||||||
|
@echo This software is meant to work under Sortix, not $(HOST)
|
||||||
|
@echo Attempt was $(MAKE) $(MAKEFLAGS)
|
||||||
|
@echo Try: $(MAKE) $(MAKEFLAGS) HOST=$(UNAME_PLATFORM)-sortix
|
||||||
|
@exit 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Provide deprecated CPU variable so makefiles can select CPU-specific dirs.
|
||||||
ifeq ($(HOST),i486-sortix)
|
ifeq ($(HOST),i486-sortix)
|
||||||
|
MACHINE:=i486
|
||||||
CPU:=x86
|
CPU:=x86
|
||||||
OTHER_PLATFORMS=x86-64-sortix
|
OTHER_PLATFORMS=x86-64-sortix
|
||||||
endif
|
endif
|
||||||
ifeq ($(HOST),x86_64-sortix)
|
ifeq ($(HOST),x86_64-sortix)
|
||||||
|
MACHINE:=x86_64
|
||||||
CPU:=x64
|
CPU:=x64
|
||||||
OTHER_PLATFORMS=i486-sortix
|
OTHER_PLATFORMS=i486-sortix
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef BUILDCC
|
# Determine the prefix for build tools.
|
||||||
BUILDCC:=gcc
|
ifndef BUILD_TOOL_PREFIX
|
||||||
endif
|
BUILD_TOOL_PREFIX:=
|
||||||
ifndef BUILDCXX
|
|
||||||
BUILDCXX:=g++
|
|
||||||
endif
|
|
||||||
ifndef BUILDAR
|
|
||||||
BUILDAR:=ar
|
|
||||||
endif
|
|
||||||
ifndef BUILDAS
|
|
||||||
BUILDAS:=as
|
|
||||||
endif
|
|
||||||
ifndef BUILDLD
|
|
||||||
BUILDAS:=ld
|
|
||||||
endif
|
|
||||||
ifndef BUILDOBJCOPY
|
|
||||||
BUILDOBJCOPY:=objcopy
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Determine the prefix for host tools.
|
||||||
|
ifndef HOST_TOOL_PREFIX
|
||||||
|
ifeq ($(BUILD),$(HOST))
|
||||||
|
HOST_TOOL_PREFIX:=$(BUILD_TOOL_PREFIX)
|
||||||
|
else
|
||||||
|
HOST_TOOL_PREFIX:=$(HOST)-
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Determine the names of the tools that target the build platform.
|
||||||
|
ifndef BUILDCC
|
||||||
|
BUILDCC:=$(BUILD_TOOL_PREFIX)gcc
|
||||||
|
endif
|
||||||
|
ifndef BUILDCXX
|
||||||
|
BUILDCXX:=$(BUILD_TOOL_PREFIX)g++
|
||||||
|
endif
|
||||||
|
ifndef BUILDAR
|
||||||
|
BUILDAR:=$(BUILD_TOOL_PREFIX)ar
|
||||||
|
endif
|
||||||
|
ifndef BUILDAS
|
||||||
|
BUILDAS:=$(BUILD_TOOL_PREFIX)as
|
||||||
|
endif
|
||||||
|
ifndef BUILDLD
|
||||||
|
BUILDAS:=$(BUILD_TOOL_PREFIX)ld
|
||||||
|
endif
|
||||||
|
ifndef BUILDOBJCOPY
|
||||||
|
BUILDOBJCOPY:=$(BUILD_TOOL_PREFIX)objcopy
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Determine the names of the tools that target the host platform.
|
||||||
ifndef HOSTCC
|
ifndef HOSTCC
|
||||||
HOSTCC:=$(HOST)-gcc
|
HOSTCC:=$(HOST_TOOL_PREFIX)gcc
|
||||||
endif
|
endif
|
||||||
ifndef HOSTCXX
|
ifndef HOSTCXX
|
||||||
HOSTCXX:=$(HOST)-g++
|
HOSTCXX:=$(HOST_TOOL_PREFIX)g++
|
||||||
endif
|
endif
|
||||||
ifndef HOSTAR
|
ifndef HOSTAR
|
||||||
HOSTAR:=$(HOST)-ar
|
HOSTAR:=$(HOST_TOOL_PREFIX)ar
|
||||||
endif
|
endif
|
||||||
ifndef HOSTAS
|
ifndef HOSTAS
|
||||||
HOSTAS:=$(HOST)-as
|
HOSTAS:=$(HOST_TOOL_PREFIX)as
|
||||||
endif
|
endif
|
||||||
ifndef HOSTLD
|
ifndef HOSTLD
|
||||||
HOSTLD:=$(HOST)-ld
|
HOSTLD:=$(HOST_TOOL_PREFIX)ld
|
||||||
endif
|
endif
|
||||||
ifndef HOSTOBJCOPY
|
ifndef HOSTOBJCOPY
|
||||||
HOSTOBJCOPY:=$(HOST)-objcopy
|
HOSTOBJCOPY:=$(HOST_TOOL_PREFIX)objcopy
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CC:=$(HOSTCC)
|
CC:=$(HOSTCC)
|
||||||
CXX:=$(HOSTCXX)
|
CXX:=$(HOSTCXX)
|
||||||
AR=:$(HOSTAR)
|
AR:=$(HOSTAR)
|
||||||
AS:=$(HOSTAS)
|
AS:=$(HOSTAS)
|
||||||
LD:=$(HOSTLD)
|
LD:=$(HOSTLD)
|
||||||
OBJCOPY:=$(HOSTOBJCOPY)
|
OBJCOPY:=$(HOSTOBJCOPY)
|
||||||
|
|
161
dirs.mak
161
dirs.mak
|
@ -1,119 +1,56 @@
|
||||||
ifndef SYSROOT
|
ifeq ($(HOST_IS_SORTIX),1)
|
||||||
SYSROOT:=/
|
DEFAULT_PREFIX=
|
||||||
endif
|
|
||||||
|
|
||||||
# The locations from where the program will be invoked/run on the host machine.
|
|
||||||
# For instance, on Sortix programs are normally run from the /bin union
|
|
||||||
# directory, even though they are actually installed somewhere else.
|
|
||||||
ifndef RUNPREFIXNAME
|
|
||||||
RUNPREFIXNAME:=/
|
|
||||||
endif
|
|
||||||
RUNPREFIXNAME:=$(shell echo "$(RUNPREFIXNAME)" | sed 's/\/\/*/\//g')
|
|
||||||
|
|
||||||
ifndef RUNPREFIX
|
|
||||||
RUNPREFIX:=/$(RUNPREFIXNAME)
|
|
||||||
endif
|
|
||||||
RUNPREFIX:=$(shell echo "$(RUNPREFIX)" | sed 's/\/\/*/\//g')
|
|
||||||
|
|
||||||
ifndef RUNBINDIR
|
|
||||||
RUNBINDIR:=$(RUNPREFIX)/bin
|
|
||||||
endif
|
|
||||||
RUNBINDIR:=$(shell echo "$(RUNBINDIR)" | sed 's/\/\/*/\//g')
|
|
||||||
|
|
||||||
ifndef RUNLIBDIR
|
|
||||||
RUNLIBDIR:=$(RUNPREFIX)/lib
|
|
||||||
endif
|
|
||||||
RUNLIBDIR:=$(shell echo "$(RUNLIBDIR)" | sed 's/\/\/*/\//g')
|
|
||||||
|
|
||||||
ifndef RUNINCLUDEDIR
|
|
||||||
RUNINCLUDEDIR:=$(RUNPREFIX)/include
|
|
||||||
endif
|
|
||||||
RUNINCLUDEDIR:=$(shell echo "$(RUNINCLUDEDIR)" | sed 's/\/\/*/\//g')
|
|
||||||
|
|
||||||
ifndef RUNBOOTDIR
|
|
||||||
RUNBOOTDIR:=$(RUNPREFIX)/boot
|
|
||||||
endif
|
|
||||||
RUNBOOTDIR:=$(shell echo "$(RUNBOOTDIR)" | sed 's/\/\/*/\//g')
|
|
||||||
|
|
||||||
# Where the program will be really installed on the host machine. For instance,
|
|
||||||
# on Sortix programs are run from the /bin union directory, but they are
|
|
||||||
# installed somewhere else, these variables tells where. Note that programs must
|
|
||||||
# not depend on being installed here, they should detect the proper directories
|
|
||||||
# at (preferably) runtime, or during the install configuration step when
|
|
||||||
# installed through package management.
|
|
||||||
ifndef PREFIXNAME
|
|
||||||
PREFIXNAME:=/data/local
|
|
||||||
endif
|
|
||||||
PREFIXNAME:=$(shell echo "$(PREFIXNAME)" | sed 's/\/\/*/\//g')
|
|
||||||
|
|
||||||
ifndef PREFIX
|
|
||||||
PREFIX:=$(SYSROOT)/$(PREFIXNAME)
|
|
||||||
endif
|
|
||||||
PREFIX:=$(shell echo "$(PREFIX)" | sed 's/\/\/*/\//g')
|
|
||||||
|
|
||||||
ifndef BINDIR
|
|
||||||
BINDIR:=$(PREFIX)/bin
|
|
||||||
endif
|
|
||||||
BINDIR:=$(shell echo "$(BINDIR)" | sed 's/\/\/*/\//g')
|
|
||||||
|
|
||||||
ifndef LIBDIR
|
|
||||||
LIBDIR:=$(PREFIX)/lib
|
|
||||||
endif
|
|
||||||
LIBDIR:=$(shell echo "$(LIBDIR)" | sed 's/\/\/*/\//g')
|
|
||||||
|
|
||||||
ifndef INCLUDEDIR
|
|
||||||
INCLUDEDIR:=$(PREFIX)/include
|
|
||||||
endif
|
|
||||||
INCLUDEDIR:=$(shell echo "$(INCLUDEDIR)" | sed 's/\/\/*/\//g')
|
|
||||||
|
|
||||||
ifndef BOOTDIR
|
|
||||||
BOOTDIR:=$(PREFIX)/boot
|
|
||||||
endif
|
|
||||||
BOOTDIR:=$(shell echo "$(BOOTDIR)" | sed 's/\/\/*/\//g')
|
|
||||||
|
|
||||||
# Where the program will be installed on the build machine. This is mostly
|
|
||||||
# useful if cross compiling or producing a software distribution image. By
|
|
||||||
# default programs will be installed in the same location as the host machine.
|
|
||||||
ifdef INSTALLPREFIX
|
|
||||||
INSTALLPREFIX_WAS_SPECIFIED=1
|
|
||||||
endif
|
|
||||||
ifndef INSTALLPREFIX
|
|
||||||
INSTALLPREFIX:=$(PREFIX)
|
|
||||||
endif
|
|
||||||
INSTALLPREFIX:=$(shell echo "$(INSTALLPREFIX)" | sed 's/\/\/*/\//g')
|
|
||||||
|
|
||||||
ifndef INSTALLBINDIR
|
|
||||||
ifdef INSTALLPREFIX_WAS_SPECIFIED
|
|
||||||
INSTALLBINDIR:=$(INSTALLPREFIX)/bin
|
|
||||||
else
|
else
|
||||||
INSTALLBINDIR:=$(BINDIR)
|
DEFAULT_PREFIX=/usr/local
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
INSTALLBINDIR:=$(shell echo "$(INSTALLBINDIR)" | sed 's/\/\/*/\//g')
|
|
||||||
|
|
||||||
ifndef INSTALLLIBDIR
|
ifeq ($(HOST_IS_SORTIX),1)
|
||||||
ifdef INSTALLPREFIX_WAS_SPECIFIED
|
DEFAULT_EXEC_PREFIX=$(PREFIX)/$(HOST)
|
||||||
INSTALLLIBDIR:=$(INSTALLPREFIX)/lib
|
|
||||||
else
|
else
|
||||||
INSTALLLIBDIR:=$(LIBDIR)
|
DEFAULT_EXEC_PREFIX=$(PREFIX)
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
INSTALLLIBDIR:=$(shell echo "$(INSTALLLIBDIR)" | sed 's/\/\/*/\//g')
|
|
||||||
|
|
||||||
ifndef INSTALLINCLUDEDIR
|
PREFIX?=$(DEFAULT_PREFIX)
|
||||||
ifdef INSTALLPREFIX_WAS_SPECIFIED
|
EXEC_PREFIX?=$(DEFAULT_EXEC_PREFIX)
|
||||||
INSTALLINCLUDEDIR:=$(INSTALLPREFIX)/include
|
BINDIR?=$(EXEC_PREFIX)/bin
|
||||||
else
|
SBINDIR?=$(EXEC_PREFIX)/sbin
|
||||||
INSTALLINCLUDEDIR:=$(INCLUDEDIR)
|
LIBEXECDIR?=$(EXEC_PREFIX)/libexec
|
||||||
endif
|
BOOTDIR?=$(PREFIX)/boot
|
||||||
endif
|
DATAROOTDIR?=$(PREFIX)/share
|
||||||
INSTALLINCLUDEDIR:=$(shell echo "$(INSTALLINCLUDEDIR)" | sed 's/\/\/*/\//g')
|
DATADIR?=$(DATAROOTDIR)
|
||||||
|
SYSCONFDIR?=$(PREFIX)/etc
|
||||||
|
SHAREDSTATEDIR?=$(PREFIX)/com
|
||||||
|
LOCALSTATEDIR?=$(PREFIX)/var
|
||||||
|
RUNSTATEDIR?=$(LOCALSTATEDIR)/run
|
||||||
|
INCLUDEDIR?=$(PREFIX)/include
|
||||||
|
DOCDIR?=$(DATAROOTDIR)/doc
|
||||||
|
INFODIR?=$(DATAROOTDIR)/info
|
||||||
|
HTMLDIR?=$(DOCDIR)
|
||||||
|
DVIDIR?=$(DOCDIR)
|
||||||
|
PSDIR?=$(DOCDIR)
|
||||||
|
PDFDIR?=$(DOCDIR)
|
||||||
|
PSDIR?=$(DOCDIR)
|
||||||
|
LIBDIR?=$(EXEC_PREFIX)/lib
|
||||||
|
LOCALEDIR?=$(DATAROOTDIR/locale
|
||||||
|
MANDIR?=$(DATAROOTDIR)/man
|
||||||
|
MAN1DIR?=$(MANDIR)/man1
|
||||||
|
MAN2DIR?=$(MANDIR)/man2
|
||||||
|
MAN3DIR?=$(MANDIR)/man3
|
||||||
|
MAN4DIR?=$(MANDIR)/man4
|
||||||
|
MAN5DIR?=$(MANDIR)/man5
|
||||||
|
MAN6DIR?=$(MANDIR)/man6
|
||||||
|
MAN7DIR?=$(MANDIR)/man7
|
||||||
|
MAN8DIR?=$(MANDIR)/man8
|
||||||
|
MAN9DIR?=$(MANDIR)/man9
|
||||||
|
MANEXT?=.1
|
||||||
|
MAN1EXT?=.1
|
||||||
|
MAN2EXT?=.2
|
||||||
|
MAN3EXT?=.3
|
||||||
|
MAN4EXT?=.4
|
||||||
|
MAN5EXT?=.5
|
||||||
|
MAN6EXT?=.6
|
||||||
|
MAN7EXT?=.7
|
||||||
|
MAN8EXT?=.8
|
||||||
|
MAN9EXT?=.9
|
||||||
|
|
||||||
ifndef INSTALLBOOTDIR
|
DESTDIR?=
|
||||||
ifdef INSTALLPREFIX_WAS_SPECIFIED
|
|
||||||
INSTALLBOOTDIR:=$(INSTALLPREFIX)/boot
|
|
||||||
else
|
|
||||||
INSTALLBOOTDIR:=$(BOOTDIR)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
INSTALLBOOTDIR:=$(shell echo "$(INSTALLBOOTDIR)" | sed 's/\/\/*/\//g')
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
|
SOFTWARE_MEANT_FOR_SORTIX=1
|
||||||
include ../compiler.mak
|
include ../compiler.mak
|
||||||
include ../version.mak
|
include ../version.mak
|
||||||
include ../dirs.mak
|
include ../dirs.mak
|
||||||
|
|
||||||
ifndef OPTLEVEL
|
ifndef OPTLEVEL
|
||||||
OPTLEVEL:=-O2
|
OPTLEVEL:=-g -O2
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef CXXFLAGS
|
ifndef CXXFLAGS
|
||||||
|
@ -47,32 +48,25 @@ clean:
|
||||||
rm -f *.o client/*.o server/*.o
|
rm -f *.o client/*.o server/*.o
|
||||||
|
|
||||||
%.o: %.cpp
|
%.o: %.cpp
|
||||||
$(HOSTCXX) -c $< -o $@ $(CPPFLAGS) $(CXXFLAGS)
|
$(HOSTCXX) -std=gnu++11 -c $< -o $@ $(CPPFLAGS) $(CXXFLAGS)
|
||||||
|
|
||||||
# Installation into sysroot
|
# Installation into sysroot
|
||||||
install: install-headers install-client install-server
|
install: install-headers install-client install-server
|
||||||
|
|
||||||
install-include-dirs: headers
|
install-include-dirs: headers
|
||||||
mkdir -p $(INSTALLINCLUDEDIR)
|
mkdir -p $(DESTDIR)$(INCLUDEDIR)
|
||||||
for D in $$(find include/ -type d | sed 's/include\/*//'); do \
|
|
||||||
mkdir -p $(INSTALLINCLUDEDIR)/$$D || exit $?; \
|
|
||||||
done
|
|
||||||
|
|
||||||
install-headers: install-include-dirs headers
|
install-headers: install-include-dirs headers
|
||||||
for SRC in $$(find include/ -type f); do \
|
cp -RTv include $(DESTDIR)$(INCLUDEDIR)
|
||||||
DEST=`echo $$SRC | sed 's/include\///'`; \
|
|
||||||
cp -P $$SRC $(INSTALLINCLUDEDIR)/$$DEST || exit $?; \
|
|
||||||
done
|
|
||||||
|
|
||||||
install-client-dirs:
|
install-client-dirs:
|
||||||
mkdir -p $(INSTALLLIBDIR)
|
mkdir -p $(DESTDIR)$(LIBDIR)
|
||||||
mkdir -p $(INSTALLLIBDIR)/$(HOST)
|
|
||||||
|
|
||||||
install-client: install-client-dirs
|
install-client: install-client-dirs client
|
||||||
cp -P client/libdispd.a $(INSTALLLIBDIR)/$(HOST)
|
cp -P client/libdispd.a $(DESTDIR)$(LIBDIR)
|
||||||
|
|
||||||
install-server-dirs:
|
install-server-dirs:
|
||||||
mkdir -p $(INSTALLBINDIR)/$(HOST)
|
mkdir -p $(DESTDIR)$(BINDIR)
|
||||||
|
|
||||||
install-server: install-server-dirs
|
install-server: install-server-dirs server
|
||||||
install server/dispd $(INSTALLBINDIR)/$(HOST)
|
install server/dispd $(DESTDIR)$(BINDIR)
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
|
SOFTWARE_MEANT_FOR_SORTIX=1
|
||||||
include ../compiler.mak
|
include ../compiler.mak
|
||||||
include ../version.mak
|
include ../version.mak
|
||||||
include ../dirs.mak
|
include ../dirs.mak
|
||||||
|
|
||||||
ifndef OPTLEVEL
|
ifndef OPTLEVEL
|
||||||
OPTLEVEL=-O2
|
OPTLEVEL=-g -O2
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef CXXFLAGS
|
ifndef CXXFLAGS
|
||||||
|
@ -18,6 +19,8 @@ conway \
|
||||||
snake \
|
snake \
|
||||||
asteroids \
|
asteroids \
|
||||||
|
|
||||||
|
INSTALLBINARIES:=$(addprefix $(DESTDIR)$(BINDIR)/,$(BINARIES))
|
||||||
|
|
||||||
LIBS:=-ldispd
|
LIBS:=-ldispd
|
||||||
|
|
||||||
all: $(BINARIES)
|
all: $(BINARIES)
|
||||||
|
@ -25,19 +28,14 @@ all: $(BINARIES)
|
||||||
.PHONY: all install uninstall clean
|
.PHONY: all install uninstall clean
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
mkdir -p $(INSTALLBINDIR)/$(HOST)
|
mkdir -p $(DESTDIR)$(BINDIR)
|
||||||
install $(BINARIES) $(INSTALLBINDIR)/$(HOST)
|
install $(BINARIES) $(DESTDIR)$(BINDIR)
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
for FILE in $(INSTALLBINDIR); do \
|
rm -f $(INSTALLBINARIES)
|
||||||
rm -f $(INSTALLBINDIR)/$(HOST)/$$FILE; \
|
|
||||||
done
|
|
||||||
|
|
||||||
%: %.cpp
|
%: %.cpp
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $< -o $@ $(LIBS)
|
$(CXX) -std=gnu++11 $(CPPFLAGS) $(CXXFLAGS) $< -o $@ $(LIBS)
|
||||||
|
|
||||||
sh: mxsh
|
|
||||||
cp $< $@
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(BINARIES) *.o
|
rm -f $(BINARIES) *.o
|
||||||
|
|
|
@ -397,7 +397,7 @@ public:
|
||||||
private:
|
private:
|
||||||
static const size_t MIN_POLYS = 5;
|
static const size_t MIN_POLYS = 5;
|
||||||
static const size_t MAX_POLYS = 12;
|
static const size_t MAX_POLYS = 12;
|
||||||
static const float MAX_TURN_SPEED = 50.0f;
|
static constexpr float MAX_TURN_SPEED = 50.0f;
|
||||||
size_t numpolygons;
|
size_t numpolygons;
|
||||||
float slice;
|
float slice;
|
||||||
float polydists[MAX_POLYS+1];
|
float polydists[MAX_POLYS+1];
|
||||||
|
|
140
libc/Makefile
140
libc/Makefile
|
@ -1,33 +1,20 @@
|
||||||
|
SOFTWARE_MEANT_FOR_SORTIX=1
|
||||||
include ../compiler.mak
|
include ../compiler.mak
|
||||||
include ../version.mak
|
include ../version.mak
|
||||||
include ../dirs.mak
|
include ../dirs.mak
|
||||||
|
|
||||||
ifndef OPTLEVEL
|
ifndef OPTLEVEL
|
||||||
OPTLEVEL:=-O2
|
OPTLEVEL:=-g -O2 -fno-omit-frame-pointer
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(DEBUG_LIBC),1)
|
|
||||||
FLAGSDEBUG=-g3
|
|
||||||
else
|
|
||||||
FLAGSDEBUG=$(OPTLEVEL)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CPUDIR:=$(CPU)
|
CPUDIR:=$(CPU)
|
||||||
|
|
||||||
ifeq ($(HOST),i486-sortix)
|
|
||||||
CPUFLAGS=
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(HOST),x86_64-sortix)
|
|
||||||
CPUFLAGS=-fPIC -mno-red-zone
|
|
||||||
endif
|
|
||||||
|
|
||||||
CPPINCLUDES=-I preproc
|
CPPINCLUDES=-I preproc
|
||||||
CPPFLAGS=-DLIBC_LIBRARY -U_GNU_SOURCE $(CPUDEFINES) $(CPPINCLUDES)
|
CPPFLAGS=-DLIBC_LIBRARY $(CPPINCLUDES)
|
||||||
FLAGS=$(CPUFLAGS) -Wall -Wextra -fno-stack-protector $(FLAGSDEBUG)
|
FLAGS=-Wall -Wextra $(OPTLEVEL)
|
||||||
CFLAGS=$(FLAGS) -std=c99
|
CFLAGS=-std=gnu99
|
||||||
CXXFLAGS=$(FLAGS) -std=gnu++0x -fno-exceptions -fno-rtti
|
CXXFLAGS=-std=gnu++11 -fno-exceptions -fno-rtti
|
||||||
ASFLAGS=$(CPUASFLAGS)
|
ASFLAGS=
|
||||||
|
|
||||||
FREEOBJS=\
|
FREEOBJS=\
|
||||||
abort.o \
|
abort.o \
|
||||||
|
@ -224,7 +211,6 @@ $(FREEOBJS) \
|
||||||
$(HOSTEDOBJS) \
|
$(HOSTEDOBJS) \
|
||||||
|
|
||||||
CRTOBJ=\
|
CRTOBJ=\
|
||||||
start.o \
|
|
||||||
crt1.o \
|
crt1.o \
|
||||||
crti.o \
|
crti.o \
|
||||||
crtn.o \
|
crtn.o \
|
||||||
|
@ -236,16 +222,33 @@ UNPROCHEADERDIRS:=$(shell find include -type d)
|
||||||
UNPROCHEADERS:=$(shell find include -type f)
|
UNPROCHEADERS:=$(shell find include -type f)
|
||||||
HEADERDIRS:=$(patsubst include%,preproc%,$(UNPROCHEADERDIRS))
|
HEADERDIRS:=$(patsubst include%,preproc%,$(UNPROCHEADERDIRS))
|
||||||
HEADERS:=$(patsubst include%,preproc%,$(UNPROCHEADERS))
|
HEADERS:=$(patsubst include%,preproc%,$(UNPROCHEADERS))
|
||||||
|
INSTALLHEADERDIRS:=$(addprefix $(DESTDIR)$(INCLUDEDIR),$(patsubst preproc%,%,$(HEADERDIRS)))
|
||||||
|
INSTALLHEADERS:=$(addprefix $(DESTDIR)$(INCLUDEDIR),$(patsubst preproc%,%,$(HEADERS)))
|
||||||
|
|
||||||
SORTIXOBJS:=$(addprefix sortix/,$(FREEOBJS))
|
SORTIXOBJS:=$(addprefix sortix/,$(FREEOBJS))
|
||||||
SORTIXCPPFLAGS:=-DSORTIX_KERNEL
|
SORTIXCPPFLAGS:=$(CPPFLAGS) -DSORTIX_KERNEL
|
||||||
|
SORTIXFLAGS:=$(FLAGS) -ffreestanding
|
||||||
|
SORTIXCFLAGS:=$(CFLAGS)
|
||||||
|
SORTIXCXXFLAGS:=$(CXXFLAGS)
|
||||||
|
ifeq ($(HOST),x86_64-sortix)
|
||||||
|
SORTIXFLAGS:=$(SORTIXFLAGS) -mno-red-zone
|
||||||
|
endif
|
||||||
|
|
||||||
BINS=libc.a libg.a libm.a libstdc++.a libc-sortix.a $(CRTOBJ)
|
BINS=libc.a libg.a libm.a libpthread.a libstdc++.a $(CRTOBJ)
|
||||||
|
BINSKERNEL=libc-sortix.a
|
||||||
|
INSTALLLIBS:=$(addprefix $(DESTDIR)$(LIBDIR)/,$(BINS))
|
||||||
|
INSTALLLIBSKERNEL:=$(addprefix $(DESTDIR)$(LIBDIR)/,$(BINSKERNEL))
|
||||||
|
|
||||||
all: $(BINS)
|
all: libs libs-kernel
|
||||||
|
|
||||||
.PHONY: all headers clean install install-include-dirs install-headers \
|
libs: $(BINS)
|
||||||
install-lib-dirs install-libs
|
|
||||||
|
libs-kernel: $(BINSKERNEL)
|
||||||
|
|
||||||
|
.PHONY: all libs headers clean install install-include-dirs install-headers \
|
||||||
|
install-lib-dirs install-libs libs-kernel
|
||||||
|
|
||||||
|
FORCE:
|
||||||
|
|
||||||
libc.a: $(OBJS)
|
libc.a: $(OBJS)
|
||||||
$(HOSTAR) rcs $@ $(OBJS)
|
$(HOSTAR) rcs $@ $(OBJS)
|
||||||
|
@ -253,17 +256,17 @@ libc.a: $(OBJS)
|
||||||
libc-sortix.a: $(SORTIXOBJS)
|
libc-sortix.a: $(SORTIXOBJS)
|
||||||
$(HOSTAR) rcs $@ $(SORTIXOBJS)
|
$(HOSTAR) rcs $@ $(SORTIXOBJS)
|
||||||
|
|
||||||
libg.a: libc.a
|
libg.a:
|
||||||
ln -sf $< $@
|
$(HOSTAR) rcs $@
|
||||||
|
|
||||||
libm.a:
|
libm.a:
|
||||||
$(HOSTAR) rcs $@
|
$(HOSTAR) rcs $@
|
||||||
|
|
||||||
libstdc++.a:
|
libpthread.a:
|
||||||
$(HOSTAR) rcs $@
|
$(HOSTAR) rcs $@
|
||||||
|
|
||||||
start.o: $(CPUDIR)/start.o
|
libstdc++.a:
|
||||||
ln -f $< $@
|
$(HOSTAR) rcs $@
|
||||||
|
|
||||||
crt1.o: $(CPUDIR)/crt1.o
|
crt1.o: $(CPUDIR)/crt1.o
|
||||||
ln -f $< $@
|
ln -f $< $@
|
||||||
|
@ -275,63 +278,66 @@ crtn.o: $(CPUDIR)/crtn.o
|
||||||
ln -f $< $@
|
ln -f $< $@
|
||||||
|
|
||||||
# header preprocessing
|
# header preprocessing
|
||||||
|
$(OBJS) $(SORTIXOBJS): $(HEADERS)
|
||||||
|
|
||||||
$(HEADERDIRS):
|
$(HEADERDIRS):
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
|
||||||
preproc/%: include/% $(HEADERDIRS)
|
preproc/%: include/%
|
||||||
mxmpp -I decl $< -o $@
|
mxmpp -I decl $< -o $@
|
||||||
|
|
||||||
|
$(HEADERS): | $(HEADERDIRS)
|
||||||
|
|
||||||
headers: $(HEADERDIRS) $(HEADERS)
|
headers: $(HEADERDIRS) $(HEADERS)
|
||||||
|
|
||||||
# standard library
|
# standard library
|
||||||
%.o: %.c headers
|
%.o: %.c
|
||||||
$(HOSTCC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS)
|
$(HOSTCC) -c $< -o $@ $(CPPFLAGS) $(FLAGS) $(CFLAGS)
|
||||||
|
|
||||||
%.o: %.cpp headers
|
%.o: %.cpp
|
||||||
$(HOSTCXX) -c $< -o $@ $(CPPFLAGS) $(CXXFLAGS)
|
$(HOSTCXX) -c $< -o $@ $(CPPFLAGS) $(FLAGS) $(CXXFLAGS)
|
||||||
|
|
||||||
%.o: %.s
|
%.o: %.s
|
||||||
$(HOSTAS) $(ASFLAGS) $< -o $@
|
$(HOSTAS) $(ASFLAGS) $< -o $@
|
||||||
|
|
||||||
# libc-sortix
|
# libc-sortix
|
||||||
sortix:
|
sortix/%.o: %.c
|
||||||
mkdir -p sortix
|
$(HOSTCC) -c $< -o $@ $(SORTIXCPPFLAGS) $(SORTIXFLAGS) $(SORTIXCFLAGS)
|
||||||
|
|
||||||
sortix/%.o: %.c $(HEADERS) sortix
|
sortix/%.o: %.cpp
|
||||||
$(HOSTCC) -c $< -o $@ $(CPPFLAGS) $(SORTIXCPPFLAGS) $(CFLAGS)
|
$(HOSTCXX) -c $< -o $@ $(SORTIXCPPFLAGS) $(SORTIXFLAGS) $(SORTIXCXXFLAGS)
|
||||||
|
|
||||||
sortix/%.o: %.cpp $(HEADERS) sortix
|
|
||||||
$(HOSTCXX) -c $< -o $@ $(CPPFLAGS) $(SORTIXCPPFLAGS) $(CXXFLAGS)
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o sortix/*.o c/*.o x86/*.o x64/*.o *.a *.so
|
rm -f $(wildcard *.o) $(wildcard */*.o) $(wildcard */*/*.o) $(wildcard *.a)
|
||||||
rm -f $(OBJS)
|
rm -rf $(HEADERDIRS)
|
||||||
rm -rf sortix $(HEADERDIRS)
|
|
||||||
|
|
||||||
# Installation into sysroot
|
# Installation into sysroot
|
||||||
install: install-headers install-libs
|
install: install-headers install-libs install-libs-kernel
|
||||||
|
|
||||||
install-include-dirs: headers
|
$(INSTALLHEADERDIRS) $(DESTDIR)$(LIBDIR):
|
||||||
mkdir -p $(INSTALLINCLUDEDIR)
|
mkdir -p $@
|
||||||
DIRS=$$(echo $(UNPROCHEADERDIRS) | \
|
|
||||||
tr ' ' '\n' | \
|
|
||||||
sed 's/include\/*//'); \
|
|
||||||
for D in $$DIRS; do \
|
|
||||||
mkdir -p $(INSTALLINCLUDEDIR)/$$D || exit $?; \
|
|
||||||
done
|
|
||||||
|
|
||||||
install-headers: install-include-dirs headers
|
$(DESTDIR)$(INCLUDEDIR)/%: preproc/%
|
||||||
for SRC in $(HEADERS); do \
|
cp $< $@
|
||||||
DEST=`echo $$SRC | sed 's/preproc\///'`; \
|
|
||||||
cp -P $$SRC $(INSTALLINCLUDEDIR)/$$DEST || exit $?; \
|
|
||||||
done
|
|
||||||
|
|
||||||
install-lib-dirs:
|
$(INSTALLHEADERS): | $(INSTALLHEADERDIRS)
|
||||||
mkdir -p $(INSTALLLIBDIR)
|
|
||||||
mkdir -p $(INSTALLLIBDIR)/$(HOST)
|
|
||||||
|
|
||||||
install-libs: install-lib-dirs
|
$(DESTDIR)$(LIBDIR)/%: %
|
||||||
for F in $(BINS); do \
|
cp -P $< $@
|
||||||
cp -P $$F $(INSTALLLIBDIR)/$(HOST) || exit $?; \
|
|
||||||
done
|
$(INSTALLLIBS): | $(DESTDIR)$(LIBDIR)
|
||||||
|
|
||||||
|
$(INSTALLLIBSKERNEL): | $(DESTDIR)$(LIBDIR)
|
||||||
|
|
||||||
|
$(DESTDIR)$(INCLUDEDIR) $(DESTDIR)$(LIBDIR) $(INSTALLHEADERS): FORCE
|
||||||
|
|
||||||
|
install-include-dirs: $(INSTALLHEADERDIRS)
|
||||||
|
|
||||||
|
install-headers: $(INSTALLHEADERDIRS) $(INSTALLHEADERS)
|
||||||
|
|
||||||
|
install-lib-dirs: $(DESTDIR)$(LIBDIR)
|
||||||
|
|
||||||
|
install-libs: $(INSTALLLIBS)
|
||||||
|
|
||||||
|
install-libs-kernel: $(INSTALLLIBSKERNEL)
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,11 @@
|
||||||
#define __END_DECLS
|
#define __END_DECLS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Sortix system components implicitly use the native API. */
|
||||||
|
#if defined(LIBC_LIBRARY) || defined(SORTIX_KERNEL)
|
||||||
|
#define _SORTIX_SOURCE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/* By default, assume the source is compiled using the native API. */
|
/* By default, assume the source is compiled using the native API. */
|
||||||
#if !defined(_SORTIX_SOURCE) && \
|
#if !defined(_SORTIX_SOURCE) && \
|
||||||
!defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) && \
|
!defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) && \
|
||||||
|
|
0
libc/sortix/.gitignore
vendored
Normal file
0
libc/sortix/.gitignore
vendored
Normal file
|
@ -23,12 +23,6 @@
|
||||||
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
/* NOTE: This is almost identical to what is in start.s. crt1.s is used when
|
|
||||||
compiling with the real cross compiler, while start.s is used when
|
|
||||||
using the older hacky way of building Sortix. Please try to keep these
|
|
||||||
files alike by doing changes both places until we only build Sortix
|
|
||||||
with real cross compilers. */
|
|
||||||
|
|
||||||
.section .text
|
.section .text
|
||||||
|
|
||||||
.global _start
|
.global _start
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
|
|
||||||
Copyright(C) Jonas 'Sortie' Termansen 2011.
|
|
||||||
|
|
||||||
This file is part of the Sortix C Library.
|
|
||||||
|
|
||||||
The Sortix C Library is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or (at your
|
|
||||||
option) any later version.
|
|
||||||
|
|
||||||
The Sortix C Library is distributed in the hope that it will be useful, but
|
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
||||||
License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
start.s
|
|
||||||
A stub for linking to the C runtime on Sortix.
|
|
||||||
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
/* NOTE: This is almost identical to what is in crt1.s. crt1.s is used when
|
|
||||||
compiling with the real cross compiler, while start.s is used when
|
|
||||||
using the older hacky way of building Sortix. Please try to keep these
|
|
||||||
files alike by doing changes both places until we only build Sortix
|
|
||||||
with real cross compilers. */
|
|
||||||
|
|
||||||
.globl _start
|
|
||||||
|
|
||||||
.section .text
|
|
||||||
|
|
||||||
.type _start, @function
|
|
||||||
_start:
|
|
||||||
|
|
||||||
movq %rcx, environ # envp
|
|
||||||
|
|
||||||
pushq %rsi
|
|
||||||
pushq %rdi
|
|
||||||
|
|
||||||
call initialize_standard_library
|
|
||||||
|
|
||||||
popq %rdi
|
|
||||||
popq %rsi
|
|
||||||
|
|
||||||
# Run main
|
|
||||||
call main
|
|
||||||
|
|
||||||
# Terminate the process with main's exit code.
|
|
||||||
movl %eax, %edi
|
|
||||||
call exit
|
|
||||||
|
|
|
@ -23,12 +23,6 @@
|
||||||
|
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
/* NOTE: This is almost identical to what is in start.s. crt1.s is used when
|
|
||||||
compiling with the real cross compiler, while start.s is used when
|
|
||||||
using the older hacky way of building Sortix. Please try to keep these
|
|
||||||
files alike by doing changes both places until we only build Sortix
|
|
||||||
with real cross compilers. */
|
|
||||||
|
|
||||||
.section .text
|
.section .text
|
||||||
|
|
||||||
.global _start
|
.global _start
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
|
|
||||||
Copyright(C) Jonas 'Sortie' Termansen 2011.
|
|
||||||
|
|
||||||
This file is part of the Sortix C Library.
|
|
||||||
|
|
||||||
The Sortix C Library is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or (at your
|
|
||||||
option) any later version.
|
|
||||||
|
|
||||||
The Sortix C Library is distributed in the hope that it will be useful, but
|
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
||||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
||||||
License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
start.s
|
|
||||||
A stub for linking to the C runtime on Sortix.
|
|
||||||
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
/* NOTE: This is almost identical to what is in crt1.s. crt1.s is used when
|
|
||||||
compiling with the real cross compiler, while start.s is used when
|
|
||||||
using the older hacky way of building Sortix. Please try to keep these
|
|
||||||
files alike by doing changes both places until we only build Sortix
|
|
||||||
with real cross compilers. */
|
|
||||||
|
|
||||||
.globl _start
|
|
||||||
|
|
||||||
.section .text
|
|
||||||
|
|
||||||
.type _start, @function
|
|
||||||
_start:
|
|
||||||
|
|
||||||
movl %ecx, environ # envp
|
|
||||||
|
|
||||||
# Arguments for main
|
|
||||||
push %ebx # argv
|
|
||||||
push %eax # argc
|
|
||||||
|
|
||||||
call initialize_standard_library
|
|
||||||
|
|
||||||
# Run main
|
|
||||||
call main
|
|
||||||
|
|
||||||
# Terminate the process with main's exit code.
|
|
||||||
push %eax
|
|
||||||
call exit
|
|
||||||
|
|
|
@ -1,18 +1,39 @@
|
||||||
|
include ../compiler.mak
|
||||||
|
include ../version.mak
|
||||||
|
include ../dirs.mak
|
||||||
|
|
||||||
|
ifndef OPTLEVEL
|
||||||
|
OPTLEVEL=-g -O2
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef CXXFLAGS
|
||||||
|
CXXFLAGS:=$(OPTLEVEL)
|
||||||
|
endif
|
||||||
|
|
||||||
SORTIXKERNEL=../sortix
|
SORTIXKERNEL=../sortix
|
||||||
LIBC=../libc
|
LIBC=../libc
|
||||||
|
|
||||||
CPPFLAGS=-I../sortix/include
|
CPPFLAGS:=$(CPPFLAGS) -I$(SORTIXKERNEL)/include
|
||||||
CXXFLAGS=-g -Wall -Wextra
|
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti
|
||||||
|
|
||||||
BINARIES=mkinitrd initrdfs
|
BINARIES=mkinitrd initrdfs
|
||||||
|
|
||||||
|
INSTALLBINARIES:=$(addprefix $(DESTDIR)$(BINDIR)/,$(BINARIES))
|
||||||
|
|
||||||
all: $(BINARIES)
|
all: $(BINARIES)
|
||||||
|
|
||||||
|
.PHONY: all install uninstall clean
|
||||||
|
|
||||||
%: %.cpp crc32.cpp rules.cpp $(LIBC)/ioleast.cpp
|
%: %.cpp crc32.cpp rules.cpp $(LIBC)/ioleast.cpp
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $< crc32.cpp rules.cpp $(LIBC)/ioleast.cpp -o $@
|
$(CXX) -std=gnu++11 $(CPPFLAGS) $(CXXFLAGS) $< crc32.cpp rules.cpp $(LIBC)/ioleast.cpp -o $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(BINARIES)
|
rm -f $(BINARIES)
|
||||||
|
|
||||||
install:
|
install: all
|
||||||
|
mkdir -p $(DESTDIR)$(BINDIR)
|
||||||
|
install $(BINARIES) $(DESTDIR)$(BINDIR)
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -f $(INSTALLBINARIES)
|
||||||
|
|
||||||
|
|
1
mxmpp/.gitignore
vendored
Normal file
1
mxmpp/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
mxmpp
|
35
mxmpp/Makefile
Normal file
35
mxmpp/Makefile
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
include ../compiler.mak
|
||||||
|
include ../version.mak
|
||||||
|
include ../dirs.mak
|
||||||
|
|
||||||
|
ifndef OPTLEVEL
|
||||||
|
OPTLEVEL=-g -O2
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef CXXFLAGS
|
||||||
|
CXXFLAGS:=$(OPTLEVEL)
|
||||||
|
endif
|
||||||
|
|
||||||
|
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti
|
||||||
|
|
||||||
|
BINARIES=mxmpp
|
||||||
|
|
||||||
|
INSTALLBINARIES:=$(addprefix $(DESTDIR)$(BINDIR)/,$(BINARIES))
|
||||||
|
|
||||||
|
all: $(BINARIES)
|
||||||
|
|
||||||
|
.PHONY: all install uninstall clean
|
||||||
|
|
||||||
|
%: %.cpp
|
||||||
|
$(CXX) -std=gnu++11 $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(BINARIES)
|
||||||
|
|
||||||
|
install: all
|
||||||
|
mkdir -p $(DESTDIR)$(BINDIR)
|
||||||
|
install $(BINARIES) $(DESTDIR)$(BINDIR)
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -f $(INSTALLBINARIES)
|
||||||
|
|
|
@ -1,69 +0,0 @@
|
||||||
subdirs = @subdirs@
|
|
||||||
top_srcdir = @top_srcdir@
|
|
||||||
srcdir = @srcdir@
|
|
||||||
prefix = @prefix@
|
|
||||||
exec_prefix = @exec_prefix@
|
|
||||||
bindir = $(exec_prefix)/bin
|
|
||||||
infodir = $(prefix)/info
|
|
||||||
libdir = $(prefix)/lib/gnudl
|
|
||||||
mandir = $(prefix)/man/man1
|
|
||||||
|
|
||||||
PACKAGE_NAME = @PACKAGE_NAME@
|
|
||||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
|
||||||
PACKAGE_TARNAME = @PACKAGE_NAME@-@PACKAGE_VERSION@
|
|
||||||
CC=@CC@
|
|
||||||
CXX=@CXX@
|
|
||||||
CPPFLAGS=@CPPFLAGS@
|
|
||||||
CXXFLAGS=@CXXFLAGS@ -Wall
|
|
||||||
LDFLAGS=@LDFLAGS@ $(LIBS)
|
|
||||||
LIBS = @LIBS@
|
|
||||||
INSTALL = @INSTALL@
|
|
||||||
EXEEXT = @EXEEXT@
|
|
||||||
HOST = @HOST@
|
|
||||||
BINARY=mxmpp$(EXEEXT)
|
|
||||||
|
|
||||||
DISTDIR:=$(PACKAGE_TARNAME)
|
|
||||||
DISTFILES=config.guess config.h.in config.sub configure configure.ac COPYING README install-sh Makefile.in mxmpp.cpp
|
|
||||||
|
|
||||||
all: $(BINARY)
|
|
||||||
|
|
||||||
$(BINARY): mxmpp.cpp
|
|
||||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ mxmpp.cpp $(LDFLAGS) $(TARGET_ARCH)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
$(RM) $(BINARY)
|
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
$(RM) Makefile config.h config.status config.cache config.log
|
|
||||||
$(RM) -r $(BUILDDIR) $(DISTDIR)
|
|
||||||
|
|
||||||
install: all
|
|
||||||
mkdir -p $(bindir)
|
|
||||||
$(INSTALL) $(BINARY) $(bindir)
|
|
||||||
|
|
||||||
dist: dist-gzip
|
|
||||||
|
|
||||||
dist-all: dist-gzip dist-lzma dist-bzip2 dist-xz
|
|
||||||
|
|
||||||
dist-gzip: $(DISTDIR)
|
|
||||||
$(RM) $(PACKAGE_TARNAME).tar.gz
|
|
||||||
tar -cf - $(DISTDIR) | gzip -9 > $(PACKAGE_TARNAME).tar.gz
|
|
||||||
|
|
||||||
dist-lzma: $(DISTDIR)
|
|
||||||
$(RM) $(PACKAGE_TARNAME).tar.lzma
|
|
||||||
tar -cf - $(DISTDIR) | lzma -9 > $(PACKAGE_TARNAME).tar.lzma
|
|
||||||
|
|
||||||
dist-bzip2: $(DISTDIR)
|
|
||||||
$(RM) $(PACKAGE_TARNAME).tar.bz2
|
|
||||||
tar -cf - $(DISTDIR) | bzip2 -9 > $(PACKAGE_TARNAME).tar.bz2
|
|
||||||
|
|
||||||
dist-xz: $(DISTDIR)
|
|
||||||
$(RM) $(PACKAGE_TARNAME).tar.xz
|
|
||||||
tar -cf - $(DISTDIR) | xz -c > $(PACKAGE_TARNAME).tar.xz
|
|
||||||
|
|
||||||
$(DISTDIR): FORCE
|
|
||||||
mkdir -p $(DISTDIR)
|
|
||||||
cp -rv $(DISTFILES) $(DISTDIR)
|
|
||||||
|
|
||||||
FORCE:
|
|
||||||
|
|
1502
mxmpp/config.guess
vendored
1502
mxmpp/config.guess
vendored
File diff suppressed because it is too large
Load diff
|
@ -1,152 +0,0 @@
|
||||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
|
||||||
|
|
||||||
/* this is an AmigaOS4 platform */
|
|
||||||
#undef AMIGAOS4_HOST
|
|
||||||
|
|
||||||
/* this is an Android platform */
|
|
||||||
#undef ANDROID_HOST
|
|
||||||
|
|
||||||
/* this is a Darwin platform */
|
|
||||||
#undef DARWIN_HOST
|
|
||||||
|
|
||||||
/* this is a FreeBSD platform */
|
|
||||||
#undef FREEBSD_HOST
|
|
||||||
|
|
||||||
/* this is a GNU platform */
|
|
||||||
#undef GNU_HOST
|
|
||||||
|
|
||||||
/* this is a Haiku platform */
|
|
||||||
#undef HAIKU_HOST
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `close' function. */
|
|
||||||
#undef HAVE_CLOSE
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
|
||||||
#undef HAVE_FCNTL_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `fprintf' function. */
|
|
||||||
#undef HAVE_FPRINTF
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
|
||||||
#undef HAVE_INTTYPES_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <memory.h> header file. */
|
|
||||||
#undef HAVE_MEMORY_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `open' function. */
|
|
||||||
#undef HAVE_OPEN
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `perror' function. */
|
|
||||||
#undef HAVE_PERROR
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `printf' function. */
|
|
||||||
#undef HAVE_PRINTF
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `sscanf' function. */
|
|
||||||
#undef HAVE_SSCANF
|
|
||||||
|
|
||||||
/* Define to 1 if stdbool.h conforms to C99. */
|
|
||||||
#undef HAVE_STDBOOL_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <stdint.h> header file. */
|
|
||||||
#undef HAVE_STDINT_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <stdio.h> header file. */
|
|
||||||
#undef HAVE_STDIO_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
|
||||||
#undef HAVE_STDLIB_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `strcmp' function. */
|
|
||||||
#undef HAVE_STRCMP
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <strings.h> header file. */
|
|
||||||
#undef HAVE_STRINGS_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <string.h> header file. */
|
|
||||||
#undef HAVE_STRING_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
|
||||||
#undef HAVE_SYS_STAT_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
|
||||||
#undef HAVE_SYS_TYPES_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <unistd.h> header file. */
|
|
||||||
#undef HAVE_UNISTD_H
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `write' function. */
|
|
||||||
#undef HAVE_WRITE
|
|
||||||
|
|
||||||
/* Define to 1 if the system has the type `_Bool'. */
|
|
||||||
#undef HAVE__BOOL
|
|
||||||
|
|
||||||
/* this is a Linux platform */
|
|
||||||
#undef LINUX_HOST
|
|
||||||
|
|
||||||
/* this is a NetBSD platform */
|
|
||||||
#undef NETBSD_HOST
|
|
||||||
|
|
||||||
/* this is an OpenBSD platform */
|
|
||||||
#undef OPENBSD_HOST
|
|
||||||
|
|
||||||
/* Define to the address where bug reports for this package should be sent. */
|
|
||||||
#undef PACKAGE_BUGREPORT
|
|
||||||
|
|
||||||
/* Define to the full name of this package. */
|
|
||||||
#undef PACKAGE_NAME
|
|
||||||
|
|
||||||
/* Define to the full name and version of this package. */
|
|
||||||
#undef PACKAGE_STRING
|
|
||||||
|
|
||||||
/* Define to the one symbol short name of this package. */
|
|
||||||
#undef PACKAGE_TARNAME
|
|
||||||
|
|
||||||
/* Define to the home page for this package. */
|
|
||||||
#undef PACKAGE_URL
|
|
||||||
|
|
||||||
/* Define to the version of this package. */
|
|
||||||
#undef PACKAGE_VERSION
|
|
||||||
|
|
||||||
/* this is a Solaris platform */
|
|
||||||
#undef SOLARIS_HOST
|
|
||||||
|
|
||||||
/* Define to 1 if you have the ANSI C header files. */
|
|
||||||
#undef STDC_HEADERS
|
|
||||||
|
|
||||||
/* this is a Win32 platform */
|
|
||||||
#undef WIN32_HOST
|
|
||||||
|
|
||||||
/* this is a WINCE6 platform */
|
|
||||||
#undef WINCE6_HOST
|
|
||||||
|
|
||||||
/* this is a WINCE platform */
|
|
||||||
#undef WINCE_HOST
|
|
||||||
|
|
||||||
/* this is a 64 platform */
|
|
||||||
#undef WORDSIZE
|
|
||||||
|
|
||||||
/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
|
|
||||||
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
|
|
||||||
#define below would cause a syntax error. */
|
|
||||||
#undef _UINT8_T
|
|
||||||
|
|
||||||
/* this is a 64 bit powerpc */
|
|
||||||
#undef __powerpc64__
|
|
||||||
|
|
||||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
|
||||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
|
||||||
#ifndef __cplusplus
|
|
||||||
#undef inline
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Define to the type of a signed integer type of width exactly 16 bits if
|
|
||||||
such a type exists and the standard includes do not define it. */
|
|
||||||
#undef int16_t
|
|
||||||
|
|
||||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
|
||||||
#undef size_t
|
|
||||||
|
|
||||||
/* Define to the type of an unsigned integer type of width exactly 8 bits if
|
|
||||||
such a type exists and the standard includes do not define it. */
|
|
||||||
#undef uint8_t
|
|
1714
mxmpp/config.sub
vendored
1714
mxmpp/config.sub
vendored
File diff suppressed because it is too large
Load diff
|
@ -1,110 +0,0 @@
|
||||||
# -*- Autoconf -*-
|
|
||||||
# Process this file with autoconf to produce a configure script.
|
|
||||||
|
|
||||||
AC_PREREQ([2.67])
|
|
||||||
AC_INIT([mxmpp], [0.1], [sortie@maxsi.org])
|
|
||||||
AC_CONFIG_SRCDIR([mxmpp.cpp])
|
|
||||||
AC_CONFIG_HEADERS([config.h])
|
|
||||||
|
|
||||||
AC_CANONICAL_BUILD
|
|
||||||
AC_CANONICAL_HOST
|
|
||||||
AC_CANONICAL_SYSTEM
|
|
||||||
|
|
||||||
# Checks for programs.
|
|
||||||
AC_PROG_CXX
|
|
||||||
AC_PROG_CC
|
|
||||||
AC_MINGW32
|
|
||||||
AC_EXEEXT
|
|
||||||
AC_PROG_INSTALL
|
|
||||||
|
|
||||||
dnl Some things you can only do by looking at the platform name.
|
|
||||||
case "${host}" in
|
|
||||||
powerpc-apple-darwin*)
|
|
||||||
AC_DEFINE([__powerpc64__], [1], [this is a 64 bit powerpc])
|
|
||||||
darwin=yes
|
|
||||||
AC_DEFINE([DARWIN_HOST], [1], [this is a Darwin platform])
|
|
||||||
;;
|
|
||||||
*-apple-darwin*)
|
|
||||||
darwin=yes
|
|
||||||
AC_DEFINE([DARWIN_HOST], [1], [this is a Darwin platform])
|
|
||||||
;;
|
|
||||||
dnl Unfortunately, all BSD distributions are not identical, so
|
|
||||||
dnl as tacky as it is to look for the distribution name, we don't
|
|
||||||
dnl have much choice. The use of these should be avoid as much as possible.
|
|
||||||
*-openbsd*)
|
|
||||||
bsd=yes
|
|
||||||
openbsd=yes
|
|
||||||
AC_DEFINE([OPENBSD_HOST], [1], [this is an OpenBSD platform])
|
|
||||||
;;
|
|
||||||
*-freebsd* | *-kfreebsd*)
|
|
||||||
bsd=yes
|
|
||||||
freebsd=yes
|
|
||||||
AC_DEFINE([FREEBSD_HOST], [1], [this is a FreeBSD platform])
|
|
||||||
;;
|
|
||||||
*-netbsd*)
|
|
||||||
bsd=yes
|
|
||||||
netbsd=yes
|
|
||||||
AC_DEFINE([NETBSD_HOST], [1], [this is a NetBSD platform])
|
|
||||||
;;
|
|
||||||
*-*solaris*)
|
|
||||||
solaris=yes
|
|
||||||
AC_DEFINE([SOLARIS_HOST], [1], [this is a Solaris platform])
|
|
||||||
;;
|
|
||||||
*-*linux*)
|
|
||||||
linux=yes
|
|
||||||
AC_DEFINE([LINUX_HOST], [1], [this is a Linux platform])
|
|
||||||
;;
|
|
||||||
*-cygwin* | *-mingw* | *-pw32*)
|
|
||||||
windows=yes
|
|
||||||
AC_DEFINE([WIN32_HOST], [1], [this is a Win32 platform])
|
|
||||||
;;
|
|
||||||
*64-*-*bsd*)
|
|
||||||
bsd_os=bsd
|
|
||||||
AC_DEFINE([WORDSIZE], [64], [this is a 64 platform])
|
|
||||||
;;
|
|
||||||
*-*amigaos*)
|
|
||||||
amigaos4=yes
|
|
||||||
AC_DEFINE([AMIGAOS4_HOST], [1], [this is an AmigaOS4 platform])
|
|
||||||
;;
|
|
||||||
*-*haiku*)
|
|
||||||
haiku=yes
|
|
||||||
AC_DEFINE([HAIKU_HOST], [1], [this is a Haiku platform])
|
|
||||||
;;
|
|
||||||
*-gnu*)
|
|
||||||
gnu=yes
|
|
||||||
AC_DEFINE([GNU_HOST], [1], [this is a GNU platform])
|
|
||||||
;;
|
|
||||||
*-*wince)
|
|
||||||
wince=yes
|
|
||||||
AC_DEFINE([WINCE_HOST], [1], [this is a WINCE platform])
|
|
||||||
;;
|
|
||||||
*-*winmo)
|
|
||||||
wince=yes
|
|
||||||
AC_DEFINE([WINCE_HOST], [1], [this is a WINCE platform])
|
|
||||||
AC_DEFINE([WINCE6_HOST], [1], [this is a WINCE6 platform])
|
|
||||||
;;
|
|
||||||
*-android*)
|
|
||||||
android=yes
|
|
||||||
AC_DEFINE([ANDROID_HOST], [1], [this is an Android platform])
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
HOST="$host"
|
|
||||||
AC_SUBST([HOST])
|
|
||||||
|
|
||||||
# Checks for header files.
|
|
||||||
AC_CHECK_HEADERS([fcntl.h unistd.h sys/types.h sys/stat.h])
|
|
||||||
AC_CHECK_HEADERS([stdint.h stdio.h string.h])
|
|
||||||
|
|
||||||
# Checks for typedefs, structures, and compiler characteristics.
|
|
||||||
AC_HEADER_STDBOOL
|
|
||||||
AC_C_INLINE
|
|
||||||
AC_TYPE_SIZE_T
|
|
||||||
AC_TYPE_UINT8_T
|
|
||||||
AC_TYPE_INT16_T
|
|
||||||
|
|
||||||
# Checks for library functions.
|
|
||||||
AC_CHECK_FUNCS([open write close fprintf strcmp printf sscanf perror])
|
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile])
|
|
||||||
AC_OUTPUT
|
|
322
mxmpp/install-sh
322
mxmpp/install-sh
|
@ -1,322 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# install - install a program, script, or datafile
|
|
||||||
|
|
||||||
scriptversion=2004-09-10.20
|
|
||||||
|
|
||||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
|
||||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
|
||||||
# following copyright and license.
|
|
||||||
#
|
|
||||||
# Copyright (C) 1994 X Consortium
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to
|
|
||||||
# deal in the Software without restriction, including without limitation the
|
|
||||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
||||||
# sell copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in
|
|
||||||
# all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
||||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
|
||||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
#
|
|
||||||
# Except as contained in this notice, the name of the X Consortium shall not
|
|
||||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
|
||||||
# ings in this Software without prior written authorization from the X Consor-
|
|
||||||
# tium.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# FSF changes to this file are in the public domain.
|
|
||||||
#
|
|
||||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
|
||||||
# `make' implicit rules from creating a file called install from it
|
|
||||||
# when there is no Makefile.
|
|
||||||
#
|
|
||||||
# This script is compatible with the BSD install script, but was written
|
|
||||||
# from scratch. It can only install one file at a time, a restriction
|
|
||||||
# shared with many OS's install programs.
|
|
||||||
|
|
||||||
# set DOITPROG to echo to test this script
|
|
||||||
|
|
||||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
|
||||||
doit="${DOITPROG-}"
|
|
||||||
|
|
||||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
|
||||||
|
|
||||||
mvprog="${MVPROG-mv}"
|
|
||||||
cpprog="${CPPROG-cp}"
|
|
||||||
chmodprog="${CHMODPROG-chmod}"
|
|
||||||
chownprog="${CHOWNPROG-chown}"
|
|
||||||
chgrpprog="${CHGRPPROG-chgrp}"
|
|
||||||
stripprog="${STRIPPROG-strip}"
|
|
||||||
rmprog="${RMPROG-rm}"
|
|
||||||
mkdirprog="${MKDIRPROG-mkdir}"
|
|
||||||
|
|
||||||
chmodcmd="$chmodprog 0755"
|
|
||||||
chowncmd=
|
|
||||||
chgrpcmd=
|
|
||||||
stripcmd=
|
|
||||||
rmcmd="$rmprog -f"
|
|
||||||
mvcmd="$mvprog"
|
|
||||||
src=
|
|
||||||
dst=
|
|
||||||
dir_arg=
|
|
||||||
dstarg=
|
|
||||||
no_target_directory=
|
|
||||||
|
|
||||||
usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
|
||||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
|
||||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
|
||||||
or: $0 [OPTION]... -d DIRECTORIES...
|
|
||||||
|
|
||||||
In the 1st form, copy SRCFILE to DSTFILE.
|
|
||||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
|
||||||
In the 4th, create DIRECTORIES.
|
|
||||||
|
|
||||||
Options:
|
|
||||||
-c (ignored)
|
|
||||||
-d create directories instead of installing files.
|
|
||||||
-g GROUP $chgrpprog installed files to GROUP.
|
|
||||||
-m MODE $chmodprog installed files to MODE.
|
|
||||||
-o USER $chownprog installed files to USER.
|
|
||||||
-s $stripprog installed files.
|
|
||||||
-t DIRECTORY install into DIRECTORY.
|
|
||||||
-T report an error if DSTFILE is a directory.
|
|
||||||
--help display this help and exit.
|
|
||||||
--version display version info and exit.
|
|
||||||
|
|
||||||
Environment variables override the default commands:
|
|
||||||
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
|
|
||||||
"
|
|
||||||
|
|
||||||
while test -n "$1"; do
|
|
||||||
case $1 in
|
|
||||||
-c) shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-d) dir_arg=true
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-g) chgrpcmd="$chgrpprog $2"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
--help) echo "$usage"; exit 0;;
|
|
||||||
|
|
||||||
-m) chmodcmd="$chmodprog $2"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-o) chowncmd="$chownprog $2"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-s) stripcmd=$stripprog
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-t) dstarg=$2
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-T) no_target_directory=true
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
--version) echo "$0 $scriptversion"; exit 0;;
|
|
||||||
|
|
||||||
*) # When -d is used, all remaining arguments are directories to create.
|
|
||||||
# When -t is used, the destination is already specified.
|
|
||||||
test -n "$dir_arg$dstarg" && break
|
|
||||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
|
||||||
for arg
|
|
||||||
do
|
|
||||||
if test -n "$dstarg"; then
|
|
||||||
# $@ is not empty: it contains at least $arg.
|
|
||||||
set fnord "$@" "$dstarg"
|
|
||||||
shift # fnord
|
|
||||||
fi
|
|
||||||
shift # arg
|
|
||||||
dstarg=$arg
|
|
||||||
done
|
|
||||||
break;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if test -z "$1"; then
|
|
||||||
if test -z "$dir_arg"; then
|
|
||||||
echo "$0: no input file specified." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
# It's OK to call `install-sh -d' without argument.
|
|
||||||
# This can happen when creating conditional directories.
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
for src
|
|
||||||
do
|
|
||||||
# Protect names starting with `-'.
|
|
||||||
case $src in
|
|
||||||
-*) src=./$src ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if test -n "$dir_arg"; then
|
|
||||||
dst=$src
|
|
||||||
src=
|
|
||||||
|
|
||||||
if test -d "$dst"; then
|
|
||||||
mkdircmd=:
|
|
||||||
chmodcmd=
|
|
||||||
else
|
|
||||||
mkdircmd=$mkdirprog
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
|
||||||
# might cause directories to be created, which would be especially bad
|
|
||||||
# if $src (and thus $dsttmp) contains '*'.
|
|
||||||
if test ! -f "$src" && test ! -d "$src"; then
|
|
||||||
echo "$0: $src does not exist." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -z "$dstarg"; then
|
|
||||||
echo "$0: no destination specified." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
dst=$dstarg
|
|
||||||
# Protect names starting with `-'.
|
|
||||||
case $dst in
|
|
||||||
-*) dst=./$dst ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# If destination is a directory, append the input filename; won't work
|
|
||||||
# if double slashes aren't ignored.
|
|
||||||
if test -d "$dst"; then
|
|
||||||
if test -n "$no_target_directory"; then
|
|
||||||
echo "$0: $dstarg: Is a directory" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
dst=$dst/`basename "$src"`
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# This sed command emulates the dirname command.
|
|
||||||
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
|
||||||
|
|
||||||
# Make sure that the destination directory exists.
|
|
||||||
|
|
||||||
# Skip lots of stat calls in the usual case.
|
|
||||||
if test ! -d "$dstdir"; then
|
|
||||||
defaultIFS='
|
|
||||||
'
|
|
||||||
IFS="${IFS-$defaultIFS}"
|
|
||||||
|
|
||||||
oIFS=$IFS
|
|
||||||
# Some sh's can't handle IFS=/ for some reason.
|
|
||||||
IFS='%'
|
|
||||||
set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
|
|
||||||
IFS=$oIFS
|
|
||||||
|
|
||||||
pathcomp=
|
|
||||||
|
|
||||||
while test $# -ne 0 ; do
|
|
||||||
pathcomp=$pathcomp$1
|
|
||||||
shift
|
|
||||||
if test ! -d "$pathcomp"; then
|
|
||||||
$mkdirprog "$pathcomp"
|
|
||||||
# mkdir can fail with a `File exist' error in case several
|
|
||||||
# install-sh are creating the directory concurrently. This
|
|
||||||
# is OK.
|
|
||||||
test -d "$pathcomp" || exit
|
|
||||||
fi
|
|
||||||
pathcomp=$pathcomp/
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -n "$dir_arg"; then
|
|
||||||
$doit $mkdircmd "$dst" \
|
|
||||||
&& { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
|
|
||||||
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
|
|
||||||
&& { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
|
|
||||||
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
|
|
||||||
|
|
||||||
else
|
|
||||||
dstfile=`basename "$dst"`
|
|
||||||
|
|
||||||
# Make a couple of temp file names in the proper directory.
|
|
||||||
dsttmp=$dstdir/_inst.$$_
|
|
||||||
rmtmp=$dstdir/_rm.$$_
|
|
||||||
|
|
||||||
# Trap to clean up those temp files at exit.
|
|
||||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
|
||||||
trap '(exit $?); exit' 1 2 13 15
|
|
||||||
|
|
||||||
# Copy the file name to the temp name.
|
|
||||||
$doit $cpprog "$src" "$dsttmp" &&
|
|
||||||
|
|
||||||
# and set any options; do chmod last to preserve setuid bits.
|
|
||||||
#
|
|
||||||
# If any of these fail, we abort the whole thing. If we want to
|
|
||||||
# ignore errors from any of these, just make sure not to ignore
|
|
||||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
|
||||||
#
|
|
||||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
|
|
||||||
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
|
|
||||||
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
|
|
||||||
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
|
|
||||||
|
|
||||||
# Now rename the file to the real destination.
|
|
||||||
{ $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
|
|
||||||
|| {
|
|
||||||
# The rename failed, perhaps because mv can't rename something else
|
|
||||||
# to itself, or perhaps because mv is so ancient that it does not
|
|
||||||
# support -f.
|
|
||||||
|
|
||||||
# Now remove or move aside any old file at destination location.
|
|
||||||
# We try this two ways since rm can't unlink itself on some
|
|
||||||
# systems and the destination file might be busy for other
|
|
||||||
# reasons. In this case, the final cleanup might fail but the new
|
|
||||||
# file should still install successfully.
|
|
||||||
{
|
|
||||||
if test -f "$dstdir/$dstfile"; then
|
|
||||||
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
|
|
||||||
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
|
|
||||||
|| {
|
|
||||||
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
|
|
||||||
(exit 1); exit
|
|
||||||
}
|
|
||||||
else
|
|
||||||
:
|
|
||||||
fi
|
|
||||||
} &&
|
|
||||||
|
|
||||||
# Now rename the file to the real destination.
|
|
||||||
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fi || { (exit 1); exit; }
|
|
||||||
done
|
|
||||||
|
|
||||||
# The final little trick to "correctly" pass the exit status to the exit trap.
|
|
||||||
{
|
|
||||||
(exit 0); exit
|
|
||||||
}
|
|
||||||
|
|
||||||
# Local variables:
|
|
||||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
|
||||||
# time-stamp-start: "scriptversion="
|
|
||||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
|
||||||
# time-stamp-end: "$"
|
|
||||||
# End:
|
|
|
@ -22,7 +22,6 @@
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
67
platform.mak
Normal file
67
platform.mak
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
UNAME_OS:=$(shell uname -o)
|
||||||
|
UNAME_PLATFORM:=$(shell uname -i)
|
||||||
|
|
||||||
|
# Detect the platform that the software is being built on.
|
||||||
|
ifndef BUILD
|
||||||
|
|
||||||
|
# If the software is being built on Sortix-
|
||||||
|
ifeq ($(UNAME_OS),Sortix)
|
||||||
|
ifeq ($(MAKEFILE_NOT_MEANT_FOR_SORTIX), 1)
|
||||||
|
makefile_not_meant_for_sortix:
|
||||||
|
@echo This makefile isn\'t meant to work under Sortix
|
||||||
|
@exit 1
|
||||||
|
endif
|
||||||
|
ifeq ($(UNAME_PLATFORM),i386)
|
||||||
|
BUILD:=i486-sortix
|
||||||
|
endif
|
||||||
|
ifeq ($(UNAME_PLATFORM),x86_64)
|
||||||
|
BUILD:=x86_64-sortix
|
||||||
|
endif
|
||||||
|
|
||||||
|
# If the softwarte is not built on Sortix.
|
||||||
|
else
|
||||||
|
ifeq ($(MEANT_FOR_SORTIX), 1)
|
||||||
|
makefile_meant_for_sortix:
|
||||||
|
@echo This makefile isn\'t meant to work under $(UNAME_OS)
|
||||||
|
@exit 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(UNAME_OS),GNU/Linux)
|
||||||
|
ifeq ($(UNAME_PLATFORM),i386)
|
||||||
|
BUILD:=i386-linux-gnu
|
||||||
|
endif
|
||||||
|
ifeq ($(UNAME_PLATFORM),x86_64)
|
||||||
|
BUILD:=x86_64-linux-gnu
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
MFLAGS:=$(MFLAGS) BUILD=$(BUILD)
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Determine the platform the software will run on.
|
||||||
|
ifndef HOST
|
||||||
|
HOST:=$(BUILD)
|
||||||
|
MFLAGS:=$(MFLAGS) HOST=$(HOST)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Determine the platform the software will target.
|
||||||
|
ifndef TARGET
|
||||||
|
TARGET:=$(HOST)
|
||||||
|
MFLAGS:=$(MFLAGS) TARGET=$(TARGET)
|
||||||
|
endif
|
||||||
|
|
||||||
|
BUILD_IS_SORTIX:=$(if $(shell echo $(BUILD) | grep sortix$),1,0)
|
||||||
|
HOST_IS_SORTIX:=$(if $(shell echo $(HOST) | grep sortix$),1,0)
|
||||||
|
TARGET_IS_SORTIX:=$(if $(shell echo $(TARGET) | grep sortix$),1,0)
|
||||||
|
|
||||||
|
# Hack to allow easy filtering in the initrd.
|
||||||
|
ifeq ($(HOST),i486-sortix)
|
||||||
|
OTHER_PLATFORMS=x86-64-sortix
|
||||||
|
OTHER_PLATFORM_1=x86-64-sortix
|
||||||
|
endif
|
||||||
|
ifeq ($(HOST),x86_64-sortix)
|
||||||
|
OTHER_PLATFORMS=i486-sortix
|
||||||
|
OTHER_PLATFORM_1=i486-sortix
|
||||||
|
endif
|
141
sortix/Makefile
141
sortix/Makefile
|
@ -1,25 +1,44 @@
|
||||||
|
SOFTWARE_MEANT_FOR_SORTIX=1
|
||||||
include ../compiler.mak
|
include ../compiler.mak
|
||||||
include ../version.mak
|
include ../version.mak
|
||||||
include ../dirs.mak
|
include ../dirs.mak
|
||||||
|
|
||||||
ifndef OPTLEVEL
|
# Default values in case the user doesn't override these variables.
|
||||||
OPTLEVEL:=-O2
|
OPTLEVEL?=-g -O2
|
||||||
|
CALLTRACE?=0
|
||||||
|
DISKWRITE?=0
|
||||||
|
ASLFAGS?=
|
||||||
|
CPPFLAGS?=
|
||||||
|
CXXFLAGS?=$(OPTLEVEL)
|
||||||
|
|
||||||
|
# Base compiler options and definitions.
|
||||||
|
|
||||||
|
CPPFLAGS:=$(CPPFLAGS) -I. -Iinclude -DSORTIX_KERNEL
|
||||||
|
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -ffreestanding -fbuiltin -std=gnu++11 \
|
||||||
|
-fno-exceptions -fno-rtti
|
||||||
|
|
||||||
|
ifeq ($(PANIC_SHORT),1)
|
||||||
|
CPPFLAGS:=$(CPPFLAGS) -DPANIC_SHORT
|
||||||
|
endif
|
||||||
|
CPPFLAGS:=$(CPPFLAGS) -DENABLE_DISKWRITE=$(DISKWRITE)
|
||||||
|
CPPFLAGS:=$(CPPFLAGS) -DENABLE_CALLTRACE=$(CALLTRACE)
|
||||||
|
ifdef VERSION
|
||||||
|
CPPFLAGS:=$(CPPFLAGS) -DVERSIONSTR=\"$(VERSION)\"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Architecture-dependent options and definitions.
|
||||||
|
|
||||||
|
BOOTOBJS:=
|
||||||
|
|
||||||
ifeq ($(CPU),x86)
|
ifeq ($(CPU),x86)
|
||||||
BUILDID=x86
|
X86FAMILY:=1
|
||||||
X86FAMILY=1
|
|
||||||
CPUFLAGS=
|
|
||||||
CPULDFLAGS=
|
|
||||||
CPUOBJS:=$(CPU)/boot.o $(CPU)/base.o $(CPU)/x86.o
|
CPUOBJS:=$(CPU)/boot.o $(CPU)/base.o $(CPU)/x86.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CPU),x64)
|
ifeq ($(CPU),x64)
|
||||||
BUILDID=x64
|
X86FAMILY:=1
|
||||||
X86FAMILY=1
|
CXXFLAGS:=$(CXXFLAGS) -mno-red-zone
|
||||||
CPUFLAGS=-ffreestanding -mno-red-zone
|
CPUOBJS:=$(CPU)/boot.o $(CPU)/base.o $(CPU)/x64.o
|
||||||
CPULDFLAGS=
|
|
||||||
CPUOBJS:=$(CPU)/base.o $(CPU)/x64.o
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef X86FAMILY
|
ifdef X86FAMILY
|
||||||
|
@ -38,50 +57,19 @@ ifdef X86FAMILY
|
||||||
x86-family/msr.o \
|
x86-family/msr.o \
|
||||||
x86-family/float.o \
|
x86-family/float.o \
|
||||||
x86-family/x86-family.o
|
x86-family/x86-family.o
|
||||||
CPUFLAGS:=$(CPUFLAGS) -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow
|
# TODO: Are these -m flags even needed in the first place?
|
||||||
|
CXXFLAGS:=$(CXXFLAGS) -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow
|
||||||
endif
|
endif
|
||||||
|
|
||||||
DIRS=. x64 x86 x86-family fs kb kb/layout
|
# Object files that constitute the kernel.
|
||||||
|
|
||||||
DEFINES:=-DSORTIX_KERNEL -U_GNU_SOURCE
|
LIBS=\
|
||||||
ifeq ($(PANIC_SHORT),1)
|
-nostdlib \
|
||||||
DEFINES:=$(DEFINES) -DPANIC_SHORT
|
|
||||||
endif
|
|
||||||
ifeq ($(DISKWRITE),1)
|
|
||||||
DEFINES:=$(DEFINES) -DENABLE_DISKWRITE=1
|
|
||||||
else
|
|
||||||
DEFINES:=$(DEFINES) -DENABLE_DISKWRITE=0
|
|
||||||
endif
|
|
||||||
ifeq ($(CALLTRACE),1)
|
|
||||||
DEFINES:=$(DEFINES) -DENABLE_CALLTRACE=1
|
|
||||||
else
|
|
||||||
DEFINES:=$(DEFINES) -DENABLE_CALLTRACE=0
|
|
||||||
endif
|
|
||||||
ifdef VERSION
|
|
||||||
DEFINES:=$(DEFINES) -DVERSIONSTR=\"$(VERSION)\"
|
|
||||||
endif
|
|
||||||
|
|
||||||
INCLUDES=-I. -Iinclude
|
|
||||||
CPPFLAGS=$(INCLUDES) $(DEFINES)
|
|
||||||
ifeq ($(DEBUG_KERNEL),1)
|
|
||||||
FLAGSDEBUG=-g3
|
|
||||||
else
|
|
||||||
FLAGSDEBUG=$(OPTLEVEL)
|
|
||||||
endif
|
|
||||||
FLAGS=$(CPUFLAGS) -Wall -Wall -Wextra -nostdlib -nostartfiles \
|
|
||||||
-nodefaultlibs -fno-stack-protector $(FLAGSDEBUG)
|
|
||||||
CFLAGS=$(FLAGS)
|
|
||||||
CXXFLAGS=$(FLAGS) -std=gnu++0x -fno-exceptions -fno-rtti
|
|
||||||
ASFLAGS=
|
|
||||||
|
|
||||||
STATICLIBS=\
|
|
||||||
-lc-sortix \
|
-lc-sortix \
|
||||||
-lgcc \
|
-lgcc \
|
||||||
|
|
||||||
HEADERDIRS:=$(shell find include -type d)
|
OBJS=\
|
||||||
HEADERS:=$(shell find include -type f)
|
$(CPUOBJS) \
|
||||||
|
|
||||||
OBJS=$(CPUOBJS) \
|
|
||||||
ata.o \
|
ata.o \
|
||||||
bga.o \
|
bga.o \
|
||||||
calltrace.o \
|
calltrace.o \
|
||||||
|
@ -143,29 +131,35 @@ ALLOBJS=\
|
||||||
$(OBJS) \
|
$(OBJS) \
|
||||||
end.o
|
end.o
|
||||||
|
|
||||||
all: sortix.bin
|
# Rules and recipes for building the kernel.
|
||||||
|
|
||||||
.PHONY: all headers clean install install-include-dirs install-headers
|
all: kernel
|
||||||
|
|
||||||
|
kernel: sortix.bin
|
||||||
|
|
||||||
|
.PHONY: all kernel headers clean install install-include-dirs install-headers \
|
||||||
|
install-kernel install-kernel-binary
|
||||||
|
|
||||||
headers:
|
headers:
|
||||||
|
|
||||||
# x64 compilation
|
# x64 compilation
|
||||||
x64/boot.o: x64/boot.s
|
ifeq ($(CPU),x64)
|
||||||
$(HOSTAS) -64 $< -o $@
|
|
||||||
|
|
||||||
sortix-x64.tmp: $(ALLOBJS) x64/boot.o
|
sortix-x86_64.bin: $(ALLOBJS)
|
||||||
$(HOSTCXX) -nodefaultlibs -nostartfiles -Wl,-N -Wl,-melf_x86_64_sortix -Wl,-Ttext -Wl,100000 -Wl,-z -Wl,max-page-size=0x1000 -o sortix-x64-internal.out x64/boot.o $(OBJS) $(STATICLIBS) end.o
|
$(HOSTCXX) $(CXXFLAGS) -Wl,-Ttext -Wl,100000 -Wl,-z -Wl,max-page-size=0x1000 $(OBJS) $(LIBS) end.o -o $@
|
||||||
$(HOSTOBJCOPY) sortix-x64-internal.out -O elf32-i386 sortix-x64.tmp
|
|
||||||
|
sortix.bin: sortix-x86_64.bin
|
||||||
|
$(HOSTOBJCOPY) $< -O elf32-i386-sortix $@
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
# x86 compilation
|
# x86 compilation
|
||||||
|
ifeq ($(CPU),x86)
|
||||||
|
|
||||||
sortix-x86.tmp: $(ALLOBJS)
|
sortix.bin: $(ALLOBJS)
|
||||||
$(HOSTCXX) -nodefaultlibs -nostartfiles -Wl,-melf_i386_sortix -Wl,-Ttext -Wl,100000 -o $@ $(OBJS) $(STATICLIBS) end.o
|
$(HOSTCXX) $(CXXFLAGS) -Wl,-Ttext -Wl,100000 $(OBJS) $(LIBS) end.o -o $@
|
||||||
|
|
||||||
# general rules
|
endif
|
||||||
|
|
||||||
sortix.bin: sortix-$(BUILDID).tmp
|
|
||||||
cp -vu $< $@
|
|
||||||
|
|
||||||
%.o: %.cpp
|
%.o: %.cpp
|
||||||
$(HOSTCXX) -c $< -o $@ $(CPPFLAGS) $(CXXFLAGS)
|
$(HOSTCXX) -c $< -o $@ $(CPPFLAGS) $(CXXFLAGS)
|
||||||
|
@ -174,29 +168,22 @@ sortix.bin: sortix-$(BUILDID).tmp
|
||||||
$(HOSTAS) $< -o $@ $(ASFLAGS)
|
$(HOSTAS) $< -o $@ $(ASFLAGS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
for D in $(DIRS); do rm -f $$D/*.o $$D/*.bin $$D/*.out $$D/*.tmp; done
|
rm -f $(ALLOBJS) sortix.bin
|
||||||
|
rm -f $(wildcard *.bin) $(wildcard *.out) $(wildcard *.tmp)
|
||||||
|
rm -f $(wildcard *.o) $(wildcard */*.o) $(wildcard */*/*.o)
|
||||||
|
|
||||||
# Installation into sysroot
|
# Installation into sysroot
|
||||||
install: install-headers install-kernel
|
install: install-headers install-kernel
|
||||||
|
|
||||||
install-include-dirs: headers
|
install-include-dirs: headers
|
||||||
mkdir -p $(INSTALLINCLUDEDIR)
|
mkdir -p $(DESTDIR)$(INCLUDEDIR)
|
||||||
DIRS=$$(echo $(HEADERDIRS) | \
|
|
||||||
tr ' ' '\n' | \
|
|
||||||
sed 's/include\/*//'); \
|
|
||||||
for D in $$DIRS; do \
|
|
||||||
mkdir -p $(INSTALLINCLUDEDIR)/$$D || exit $?; \
|
|
||||||
done
|
|
||||||
|
|
||||||
install-headers: install-include-dirs headers
|
install-headers: install-include-dirs headers
|
||||||
for SRC in $(HEADERS); do \
|
cp -RTv include $(DESTDIR)$(INCLUDEDIR)
|
||||||
DEST=`echo $$SRC | sed 's/include\///'`; \
|
|
||||||
cp -P $$SRC $(INSTALLINCLUDEDIR)/$$DEST || exit $?; \
|
|
||||||
done
|
|
||||||
|
|
||||||
install-kernel: install-kernel-binary
|
install-kernel: install-kernel-binary
|
||||||
|
|
||||||
install-kernel-binary:
|
install-kernel-binary: sortix.bin
|
||||||
mkdir -p $(INSTALLBOOTDIR)/$(HOST)
|
mkdir -p $(DESTDIR)$(BOOTDIR)/$(HOST)
|
||||||
cp -P sortix.bin $(INSTALLBOOTDIR)/$(HOST)
|
cp sortix.bin $(DESTDIR)$(BOOTDIR)/$(HOST)
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
|
SOFTWARE_MEANT_FOR_SORTIX=1
|
||||||
include ../compiler.mak
|
include ../compiler.mak
|
||||||
include ../version.mak
|
include ../version.mak
|
||||||
include ../dirs.mak
|
include ../dirs.mak
|
||||||
|
|
||||||
ifndef OPTLEVEL
|
ifndef OPTLEVEL
|
||||||
OPTLEVEL=-O2
|
OPTLEVEL=-g -O2
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef CXXFLAGS
|
ifndef CXXFLAGS
|
||||||
CXXFLAGS:=$(OPTLEVEL)
|
CXXFLAGS:=$(OPTLEVEL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
CPPFLAGS:=$(CPPFLAGS) -DVERSIONSTR=\"$(VERSION)\"
|
||||||
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti
|
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti
|
||||||
|
|
||||||
BINARIES:=\
|
BINARIES:=\
|
||||||
|
@ -38,21 +40,21 @@ head \
|
||||||
tail \
|
tail \
|
||||||
type \
|
type \
|
||||||
|
|
||||||
|
INSTALLBINARIES:=$(addprefix $(DESTDIR)$(BINDIR)/,$(BINARIES))
|
||||||
|
|
||||||
all: $(BINARIES)
|
all: $(BINARIES)
|
||||||
|
|
||||||
.PHONY: all install uninstall clean
|
.PHONY: all install uninstall clean
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
mkdir -p $(INSTALLBINDIR)/$(HOST)
|
mkdir -p $(DESTDIR)$(BINDIR)
|
||||||
install $(BINARIES) $(INSTALLBINDIR)/$(HOST)
|
install $(BINARIES) $(DESTDIR)$(BINDIR)
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
for FILE in $(INSTALLBINDIR); do \
|
rm -f $(INSTALLBINARIES) $(DESTDIR)$(BINDIR)/install
|
||||||
rm -f $(INSTALLBINDIR)/$(HOST)/$$FILE; \
|
|
||||||
done
|
|
||||||
|
|
||||||
%: %.cpp
|
%: %.cpp
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
$(CXX) -std=gnu++11 $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
||||||
|
|
||||||
sh: mxsh
|
sh: mxsh
|
||||||
cp $< $@
|
cp $< $@
|
||||||
|
|
Loading…
Reference in a new issue