# # (C) Copyright 1992, ..., 2007 the "DOSEMU-Development-Team". # # for details see file COPYING.DOSEMU in the DOSEMU distribution # # Makefile for Linux DOSEMU # # You should do a "make" to compile and a "make install" as root to # install DOSEMU. SYS = ../commands dosemudir = $(datadir)/dosemu NET=dosext/net # # This is defined when the SB Emulation is required. You should re-configure, # rather than just change this. # ifdef USE_SBEMU SBEMU=dosext/sound arch/linux/dosext/sound base/dev/sb16 base/sound MIDID=arch/linux/dosext/sound/midid endif # # This is defined when the CPU emulator is required. You should # re-configure, rather than just change this. # ifdef X86_EMULATOR XCPUEMU=emu-i386/simx86 endif REQUIRED += $(MIDID) LIBSUBDIRS=env/video base base/async \ arch/linux/async arch/linux/mapping \ base/misc base/misc/libpcl base/dev/misc\ emu-i386 $(XCPUEMU) env base/speaker \ base/dev/pic dosext/dpmi dosext/mfs dosext/misc\ base/init base/serial base/mouse\ base/dev/dma \ $(DEBUGGER) $(NET) $(IPX) $(SBEMU) dosext/drivers base/bios \ $(PLUGINSUBDIRS) # call all libraries the name of the directory LIBS_ := ${addsuffix .a,${addprefix lib/lib,$(subst /,_,$(LIBSUBDIRS))}} DOCS= ../man ################################################################### default: version include/version.h include/confpath.h ../dosemu.spec doslib \ ../etc/xtermdos ../etc/xinstallvgafont ../etc/vga10x24.pcf.gz ../etc/xtermdos: $(REALTOPDIR)/etc/xtermdos.sh @echo "#!/bin/sh" > ../etc/xtermdos @echo >> ../etc/xtermdos @echo X11ROOTDIR=$(X11ROOTDIR) >> ../etc/xtermdos @echo >> ../etc/xtermdos @cat $(REALTOPDIR)/etc/xtermdos.sh >> ../etc/xtermdos ../etc/xinstallvgafont: $(REALTOPDIR)/etc/xinstallvgafont.sh @echo "#!/bin/sh" > ../etc/xinstallvgafont @echo >> ../etc/xinstallvgafont @echo X11ROOTDIR=$(X11ROOTDIR) >> ../etc/xinstallvgafont @echo >> ../etc/xinstallvgafont @cat $(REALTOPDIR)/etc/xinstallvgafont.sh >> ../etc/xinstallvgafont ../etc/vga10x24.pcf.gz: ifdef X_SUPPORT @for i in $(REALTOPDIR)/etc/*.bdf; do \ bdftopcf $$i | gzip -c -9 > ../etc/`basename $$i .bdf`.pcf.gz; \ done @cd ../etc; mkfontdir -x bdf endif emu.o: emu.c $(BINPATH)/bin/$(DOSBIN): emu.o $(LIBS_) $(LD) $(ALL_LDFLAGS) $(DOSBIN_LDFLAGS) -o $@ emu.o \ -Wl,--whole-archive $(LIBS_) -Wl,--no-whole-archive $(LIBS) @nm $(BINPATH)/bin/$(DOSBIN) | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)' | \ sort > $(BINPATH)/bin/dosemu.map @ln -sf $(DOSBIN) $(BINPATH)/bin/dos ifdef X_SUPPORT @ln -sf $(DOSBIN) $(BINPATH)/bin/xdos endif $(BINPATH)/bin/dosemu: $(REALTOPDIR)/dist/dosemu.systemwide $(REALTOPDIR)/dist/dosemu sed -e "s|SYSTEM_BIN_PATH=NOT_SYSTEM_WIDE|SYSTEM_BIN_PATH=$(bindir)|" \ $< > $(BINPATH)/bin/dosemu tail -n +9 $(REALTOPDIR)/dist/dosemu >> $(BINPATH)/bin/dosemu chmod +x $(BINPATH)/bin/dosemu bin: $(BINPATH)/bin/$(DOSBIN) $(BINPATH)/bin/dosemu # This recursive call seems to be necessary to deal with parallel makes. # Otherwise the rule for $(DOSBIN) would depend on a phony target, and # this does not seem to be supported by GNU Make. dosemu: $(LIBSUBDIRS) @$(MAKE) bin DIRLIST=$(REQUIRED) $(DOCS) $(LIBSUBDIRS) $(OPTIONALSUBDIRS) .PHONY: dossubdirs optionalsubdirs docsubdirs dosemu bin .PHONY: $(DIRLIST) optionalsubdirs: $(OPTIONALSUBDIRS) docsubdirs: $(DOCS) $(DIRLIST): @($(MAKE) SUBDIR:=$@ -C $@) version: versetup versetup: @mkdir -p lib @mkdir -p $(BINPATH)/bin @mkdir -p $(BINPATH)/commands @cp -p commands/precompiled/*.{com,exe} $(BINPATH)/commands 2> /dev/null || true @rm -f ../bin ../commands @ln -sf $(THISVERSION)/bin ../bin @ln -sf $(THISVERSION)/commands ../commands .PHONY: include/version.h include/version.h: @if ! test -f include/version.h || test \"$(PACKAGE_VERSION)\" != \ `echo VERSTR | $(CC) -E -include include/version.h - | tail -n 1`; \ then \ echo "Updating version.h"; \ echo "#ifndef VERSION_H" > $@; \ echo "#define VERSION_H" >> $@; \ echo "#define VERSTR \"$(PACKAGE_VERSION)\"" >> $@; \ echo "#define VERSION $(VERSION)" >> $@; \ echo "#define SUBLEVEL $(SUBLEVEL)" >> $@; \ echo "#define PATCHLEVEL1 $(PATCHLEVEL1)" >> $@; \ echo "#define PATCHLEVEL2 $(PATCHLEVEL2)" >> $@; \ echo "#define VERDATE \"$(RELEASE_DATE)\"" >> $@; \ echo "#endif /* VERSION_H */" >> $@; \ fi include/confpath.h: ../Makefile.conf echo '#define ALTERNATE_ETC "$(sysconfdir)"' > $@ echo '#define LIB_DEFAULT "$(libdir)"' >> $@ echo '#define DOSEMULIB_DEFAULT "$(dosemudir)"' >> $@ echo '#define DOSEMUHDIMAGE_DEFAULT "$(syshdimagedir)"' >> $@ echo '#define SYSTEM_XFONTS_PATH "$(x11fontdir)"' >> $@ ../dosemu.spec: ../dosemu.spec.in sed -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' $< > $@ doslib: $(REQUIRED) $(DOCS) dosemu @echo "" @echo "---------------------------------DONE compiling-------------------------------" @echo "" @echo " Now you must install DOSEMU. Make sure you are root and:" @echo " make install" @echo "" @echo "" installnew: doslib $(MAKE) install install: $(INSTALL) -d $(DESTDIR)$(dosemudir) -rm -rf $(DESTDIR)$(dosemudir)/commands $(DESTDIR)$(dosemudir)/freedos/dosemu -rm -rf $(DESTDIR)$(dosemudir)/drive_z/dosemu $(INSTALL) -d $(DESTDIR)$(sysconfdir) cd $(REALTOPDIR); if [ -f $(fdtarball) ]; then \ if [ -h $(DESTDIR)$(dosemudir)/freedos ]; then \ rm -f $(DESTDIR)$(dosemudir)/freedos; \ fi; \ if [ -d $(DESTDIR)$(dosemudir)/drive_z ]; then \ mv $(DESTDIR)$(dosemudir)/drive_z $(DESTDIR)$(dosemudir)/freedos; \ fi; \ rm -f $(DESTDIR)$(dosemudir)/freedos/tmp; \ tar -C $(DESTDIR)$(dosemudir)/.. --no-same-owner -xpzf $(fdtarball); \ rm -f $(DESTDIR)$(dosemudir)/FDchange.log; \ rm -f $(DESTDIR)$(dosemudir)/README.bindist; \ mv $(DESTDIR)$(dosemudir)/freedos $(DESTDIR)$(dosemudir)/drive_z; \ $(INSTALL) -m 0644 dist/config.sys $(DESTDIR)$(dosemudir)/drive_z; \ $(INSTALL) -m 0644 dist/autoexec.bat $(DESTDIR)$(dosemudir)/drive_z; \ $(INSTALL) -m 0644 dist/config.emu $(DESTDIR)$(dosemudir)/drive_z; \ $(INSTALL) -m 0644 dist/autoemu.bat $(DESTDIR)$(dosemudir)/drive_z; \ $(INSTALL) -d $(DESTDIR)$(sysconfdir)/drives; \ if [ ! -e $(DESTDIR)$(sysconfdir)/drives/c ]; then \ ln -sf $(dosemudir)/drive_z $(DESTDIR)$(sysconfdir)/drives/c; \ fi; \ if [ ! -e $(DESTDIR)$(sysconfdir)/drives/d ]; then \ ln -sf $(dosemudir)/drive_z $(DESTDIR)$(sysconfdir)/drives/d; \ fi; \ rm -rf $(DESTDIR)$(dosemudir)/drive_z/tmp; \ ln -sf /tmp $(DESTDIR)$(dosemudir)/drive_z/tmp; \ ln -sf drive_z $(DESTDIR)$(dosemudir)/freedos; \ fi $(INSTALL) -d $(DESTDIR)$(dosemudir)/drive_z/dosemu for i in `find $(SYS)/* -type f`; do \ $(INSTALL) -m 0644 $$i $(DESTDIR)$(dosemudir)/drive_z/dosemu; \ done cd $(SYS); for i in `find * -type l`; do \ ln -sf generic.com $(DESTDIR)$(dosemudir)/drive_z/dosemu/$$i; \ done ln -sf drive_z/dosemu $(DESTDIR)$(dosemudir)/commands if [ ! -f $(DESTDIR)$(sysconfdir)/dosemu.conf ]; then \ $(INSTALL) -m 0644 $(REALTOPDIR)/etc/dosemu.conf $(DESTDIR)$(sysconfdir); \ $(INSTALL) -m 0644 $(REALTOPDIR)/etc/dosemu.users.example $(DESTDIR)$(sysconfdir)/dosemu.users; \ $(INSTALL) -m 0644 $(REALTOPDIR)/etc/global.conf $(DESTDIR)$(sysconfdir); \ fi $(INSTALL) -d $(DESTDIR)$(dosemudir)/keymap for i in $(REALTOPDIR)/etc/keymap/*; do \ if [ -f $$i ]; then \ $(INSTALL) -m 0644 $$i $(DESTDIR)$(dosemudir)/keymap; \ fi; \ done $(INSTALL) -d $(DESTDIR)$(bindir) $(INSTALL) -m 0755 ../bin/$(DOSBIN) $(DESTDIR)$(bindir) $(INSTALL) -m 0755 ../bin/dosemu $(DESTDIR)$(bindir) $(INSTALL) -m 0755 ../bin/mkfatimage $(DESTDIR)$(bindir) $(INSTALL) -m 0755 ../bin/mkfatimage16 $(DESTDIR)$(bindir) ifdef USE_SBEMU $(INSTALL) -m 0755 ../bin/midid $(DESTDIR)$(bindir) endif ifdef USE_MHPDBG $(INSTALL) -m 0755 ../bin/dosdebug $(DESTDIR)$(bindir) endif $(INSTALL) -d $(DESTDIR)$(libdir)/dosemu for i in ../bin/*.so; do \ if [ -f $$i ]; then \ $(INSTALL) -m 0644 $$i $(DESTDIR)$(libdir)/dosemu; \ fi; \ done $(INSTALL) -d $(DESTDIR)$(docdir) for i in README.bindist NEWS THANKS COPYING COPYING.DOSEMU BUGS ChangeLog; do \ $(INSTALL) -m 0644 $(REALTOPDIR)/$$i $(DESTDIR)$(docdir); \ done for i in README README-tech dosemu-HOWTO sound-usage DANG EMUfailure \ NOVELL-HOWTO; do \ $(INSTALL) -m 0644 $(REALTOPDIR)/doc/$$i.txt $(DESTDIR)$(docdir); \ done $(INSTALL) -m 0644 $(REALTOPDIR)/doc/announce $(DESTDIR)$(docdir) $(INSTALL) -m 0644 $(REALTOPDIR)/doc/README.gdb $(DESTDIR)$(docdir) ifdef X_SUPPORT if [ ! -e $(DESTDIR)$(bindir)/xdosemu ]; then ln -s dosemu $(DESTDIR)$(bindir)/xdosemu; fi $(INSTALL) -d $(DESTDIR)$(x11fontdir) if [ -w $(DESTDIR)$(x11fontdir) ] && \ [ ! -e $(DESTDIR)$(x11fontdir)/vga10x24.pcf ] && \ [ ! -e $(DESTDIR)$(x11fontdir)/vga10x24.pcf.Z ] && \ [ ! -e $(DESTDIR)$(x11fontdir)/vga10x24.pcf.gz ]; then \ echo "-> Main DOSEMU files installation done. Installing the X PC fonts..."; \ for i in ../etc/*.pcf.gz; do \ install -m 0644 $$i $(DESTDIR)$(x11fontdir); \ done; \ install -m 0644 ../etc/fonts.dir $(DESTDIR)$(x11fontdir); \ cd $(REALTOPDIR)/etc; \ if [ ! -f $(DESTDIR)$(x11fontdir)/fonts.alias ]; then \ $(INSTALL) -m 0644 dosemu.alias $(DESTDIR)$(x11fontdir)/fonts.alias; \ elif ! grep -q ^vga $(DESTDIR)$(x11fontdir)/fonts.alias; then \ cat dosemu.alias >> $(DESTDIR)$(x11fontdir)/fonts.alias; \ cd $(DESTDIR)$(x11fontdir); \ mkfontdir; \ elif ! grep -q ^[^v][^g][^a] $(DESTDIR)$(x11fontdir)/fonts.alias; then \ $(INSTALL) -m 0644 dosemu.alias $(DESTDIR)$(x11fontdir)/fonts.alias; \ fi; \ fi; endif $(MAKE) -C ../man install @if test $(sysconfdir) != /etc; then \ if [ -f $(DESTDIR)/etc/dosemu.users ]; then \ echo ; \ echo /etc/dosemu.users exists but you did not set sysconfdir=/etc; \ echo Deprecated: moving to /etc/dosemu/dosemu.users; \ echo mv /etc/dosemu.users /etc/dosemu/dosemu.users; \ mv /etc/dosemu.users /etc/dosemu/dosemu.users; \ fi; \ if [ -f $(DESTDIR)/etc/dosemu.conf ]; then \ echo ; \ echo /etc/dosemu.conf exists but you did not set sysconfdir=/etc; \ echo Deprecated: moving to /etc/dosemu/dosemu.conf; \ echo mv /etc/dosemu.conf /etc/dosemu/dosemu.conf; \ mv /etc/dosemu.conf /etc/dosemu/dosemu.conf; \ fi \ fi @echo ""; \ echo "---------------------------------DONE Installing-------------------------------"; \ echo "" @cd $(REALTOPDIR); if test $(fdtarball) != none -a ! -f $(fdtarball); then \ echo WARNING ;\ echo No FreeDOS tarball \($(fdtarball)\) found. If you are not ;\ echo upgrading a working existing installation then please download one ;\ echo from http://www.dosemu.org and re-run "make install".; \ echo You can also use this procedure to upgrade an existing *FreeDOS*; \ echo installation when a new tarball is available.; \ echo Alternatively you can set fdtarball to none in compiletime-settings; \ echo and use another DOS, which can be installed using dosemu -install,; \ echo referred to using \$$_hdimage in $(sysconfdir)/dosemu.conf or \~/.dosemurc; \ echo or symbolically linked from \~/.dosemu/drives/c.; \ echo ; \ fi @echo " - You can type 'dosemu' to run DOSEMU. If you installed the FreeDOS tarball"; \ echo " too (see the warning above), then DOSEMU will set up a directory structure"; \ echo " in your home directory when you run it for the first time." ifdef X_SUPPORT @echo " - An icon for use with your favourite window manager is at"; \ echo " $(REALTOPDIR)/etc/dosemu.xpm" endif @echo " - Try emumouse.exe -r if your INTERNAL mouse won't work"; \ echo " - Try unix.exe to run a Unix command under DOSEMU"; \ echo ""; \ echo " NOTE: DOSEMU is no longer installed suid-root by default!"; \ echo "Please see the README and INSTALL files for additional information."; \ echo "" converthd: hdimage mv hdimage hdimage.preconvert periph/mkhdimage -h 4 -s 17 -c 40 | cat - hdimage.preconvert > hdimage @echo "Your hdimage is now converted and ready to use with 0.52 and above!" newhd: tools/periph/bootsect tools/periph/mkhdimage -h 4 -s 17 -c 40 | cat - tools/periph/bootsect > newhd @echo "You now have a hdimage file called 'newhd'" local_clean: -rm -f $(BINPATH)/bin/$(DOSBIN) $(BINPATH)/bin/xdos \ $(BINPATH)/bin/dos $(BINPATH)/bin/*.so *.s core \ *.tmp $(BINPATH)/bin/dosemu.map *.o $(BINPATH)/bin/dosdebug clean:: local_clean realclean:: local_clean CLEANDIRS=$(addsuffix .clean, $(DIRLIST)) REALCLEANDIRS=$(addsuffix .realclean, $(DIRLIST)) clean:: $(CLEANDIRS) realclean:: $(REALCLEANDIRS) .PHONY: $(CLEANDIRS) $(CLEANDIRS): -@$(MAKE) -C $(subst .clean,,$@) clean CLEANING=true .PHONY: $(REALCLEANDIRS) $(REALCLEANDIRS): -@$(MAKE) -C $(subst .realclean,,$@) realclean CLEANING=true pristine: realclean -rm -rf lib -rm -rf $(BINPATH) ../bin ../commands ../etc/xtermdos ../etc/xinstallvgafont ../etc/*.pcf.gz ../etc/fonts.dir -rm -rf ../testboot