# # 86Box A hypervisor and IBM PC system emulator that specializes in # running old operating systems and software designed for IBM # PC systems and compatibles from 1981 through fairly recent # system designs based on the PCI bus. # # This file is part of the 86Box distribution. # # Modified Makefile for Win32 (MinGW32) environment. # # Version: @(#)Makefile.mingw 1.0.60 2017/10/14 # # Authors: Miran Grca, # Fred N. van Kempen, # # Name of the executable. ifndef PROG PROG := 86Box endif # Various compile-time options. # -DROM_TRACE=0xc800 traces ROM access from segment C800 # -DIO_TRACE=0x66 traces I/O on port 0x66 STUFF := # Add feature selections here. # -DANSI_CFG forces the config file to ANSI encoding. # -DENABLE_VRAM_DUMP enables Video Ram dumping. # -DENABLE_LOG_BREAKPOINT enables extra logging. # -DENABLE_SCSI_BIOS_COMMAND_LOG=n enables extra logging. # -DENABLE_AHA154X_LOG=n enables extra logging. # -DENABLE_BUSLOGIC_LOG=n enables extra logging. # -DENABLE_CDROM_LOG enables extra logging. # -DENABLE_D86F_LOG enables extra logging. # -DENABLE_FDC_LOG enables extra logging. # -DENABLE_HDD_IMAGE_LOG enables extra logging. # -DENABLE_IDE_LOG enables extra logging. # -DENABLE_SERIAL_LOG enables extra logging. # -DENABLE_NIC_LOG enables extra logging. # -DENABLE_KEYBOARD_LOG enables extra logging. ifndef EXTRAS EXTRAS := endif # Defaults for several build options (possibly defined in a chained file.) ifndef AUTODEP AUTODEP := n endif ifndef DEBUG DEBUG := n endif ifndef OPTIM OPTIM := n endif ifndef RELEASE RELEASE := n endif ifndef USB USB := n endif ifndef VNC VNC := n endif ifndef RDP RDP := n endif ifndef DEV_BUILD DEV_BUILD := n endif ifndef DEV_BRANCH DEV_BRANCH := n endif ifndef CIRRUS CIRRUS := n endif ifndef NE1000 NE1000 := n endif ifndef NV_RIVA NV_RIVA := n endif ifndef FLUIDSYNTH FLUIDSYNTH := y endif ifndef MUNT MUNT := y endif ifndef PAS16 PAS16 = n endif ifndef X64 X64 := n endif ifeq ($(DEV_BUILD), y) DEV_BRANCH := y CIRRUS := y NE1000 := y NV_RIVA := y PAS16 := y VNC := y endif ######################################################################### # Nothing should need changing from here on.. # ######################################################################### VPATH := $(EXPATH) . cpu \ cdrom disk floppy game machine \ sound \ sound/munt sound/munt/c_interface sound/munt/sha1 \ sound/munt/srchelper \ sound/resid-fp \ scsi video lzf network network/slirp win ifeq ($(X64), y) CPP := g++ -m64 CC := gcc -m64 else CPP := g++ -m32 CC := gcc -m32 endif WINDRES := windres DEPS = -MMD -MF $*.d -c $< # Set up the correct toolchain flags. OPTS := -DWIN32 $(EXTRAS) $(STUFF) ifdef EXFLAGS OPTS += $(EXFLAGS) endif ifdef EXINC OPTS += -I$(EXINC) endif ifeq ($(X64), y) ifeq ($(OPTIM), y) DFLAGS := -march=native else DFLAGS := endif else ifeq ($(OPTIM), y) DFLAGS := -march=native else DFLAGS := -march=i686 endif endif ifeq ($(DEBUG), y) DFLAGS += -ggdb -DDEBUG AOPTIM := ifndef COPTIM COPTIM := -Og endif else ifeq ($(OPTIM), y) AOPTIM := -mtune=native ifndef COPTIM COPTIM := -O6 endif else ifndef COPTIM COPTIM := -O3 endif endif endif AFLAGS := -msse -msse2 -mfpmath=sse CFLAGS := $(OPTS) $(DFLAGS) $(COPTIM) $(AOPTIM) $(AFLAGS) \ -fomit-frame-pointer -mstackrealign -Wall RFLAGS := --input-format=rc -O coff ifeq ($(RELEASE), y) CFLAGS += -DRELEASE_BUILD RFLAGS += -DRELEASE_BUILD endif ifeq ($(VRAMDUMP), y) CFLAGS += -DENABLE_VRAM_DUMP RFLAGS += -DENABLE_VRAM_DUMP endif ifeq ($(X64), y) PLATCG := codegen_x86-64.o CGOPS := codegen_ops_x86-64.h VCG := vid_voodoo_codegen_x86-64.h else PLATCG := codegen_x86.o CGOPS := codegen_ops_x86.h VCG := vid_voodoo_codegen_x86.h endif # Optional modules. ifeq ($(FLUIDSYNTH), y) CFLAGS += -DUSE_FLUIDSYNTH FSYNTHOBJ := midi_fluidsynth.o endif ifeq ($(MUNT), y) CFLAGS += -DUSE_MUNT MUNTOBJ := midi_mt32.o \ Analog.o BReverbModel.o File.o FileStream.o LA32Ramp.o \ LA32FloatWaveGenerator.o LA32WaveGenerator.o \ MidiStreamParser.o Part.o Partial.o PartialManager.o \ Poly.o ROMInfo.o SampleRateConverter_dummy.o Synth.o \ Tables.o TVA.o TVF.o TVP.o sha1.o c_interface.o endif ifeq ($(VNC), y) CFLAGS += -DUSE_VNC RFLAGS += -DUSE_VNC CFLAGS += -I$(VNC_PATH)\INCLUDE VNCLIB := $(VNC_PATH)\LIB\libvncserver.a VNCOBJ := win_vnc.o endif ifeq ($(RDP), y) CFLAGS += -DUSE_RDP RFLAGS += -DUSE_RDP CFLAGS += -I$(RDP_PATH)\INCLUDE RDPLIB := $(RDP_PATH)\LIB\librdp.a RDPOBJ := win_rdp.o endif # Options for the DEV branch. ifeq ($(DEV_BRANCH), y) CFLAGS += -DDEV_BRANCH DEVBROBJ := ifeq ($(CIRRUS), y) CFLAGS += -DUSE_CIRRUS DEVBROBJ += vid_cl_gd.o vid_cl_gd_blit.o vid_cl_ramdac.o endif ifeq ($(NE1000), y) CFLAGS += -DUSE_NE1000 endif ifeq ($(NV_RIVA), y) CFLAGS += -DUSE_RIVA DEVBROBJ += vid_nv_riva128.o endif ifeq ($(PAS16), y) CFLAGS += -DUSE_PAS16 DEVBROBJ += snd_pas16.o endif endif # Options for works-in-progress. ifndef SERIAL SERIAL := serial.o endif ifndef EUROPC EUROPC := machine_europc.o endif MAINOBJ := pc.o config.o random.o timer.o io.o dma.o nmi.o pic.o \ pit.o ppi.o pci.o mca.o mcr.o mem.o memregs.o rom.o \ device.o nvr.o nvr_at.o nvr_ps2.o \ intel.o intel_flash.o intel_sio.o CPUOBJ := cpu.o 386.o 386_dynarec.o 386_dynarec_ops.o 808x.o \ codegen.o \ codegen_ops.o \ codegen_timing_common.o codegen_timing_486.o \ codegen_timing_686.o codegen_timing_pentium.o \ codegen_timing_winchip.o $(PLATCG) \ x86seg.o x87.o MCHOBJ := machine.o \ machine_common.o \ machine_amstrad.o $(EUROPC) \ machine_olivetti_m24.o \ machine_pcjr.o \ machine_tandy.o \ machine_xt.o machine_xt_laserxt.o \ machine_at.o \ machine_at_ali1429.o machine_at_commodore.o \ machine_at_neat.o machine_at_headland.o \ machine_at_opti495.o machine_at_scat.o \ machine_at_wd76c10.o \ machine_at_sis_85c471.o machine_at_sis_85c496.o \ machine_at_430lx_nx.o machine_at_430fx.o \ machine_at_430hx.o machine_at_430vx.o \ machine_at_440fx.o \ machine_ps1.o \ machine_ps2_isa.o machine_ps2_mca.o DEVOBJ := bugger.o lpt.o $(SERIAL) \ tandy_eeprom.o tandy_rom.o \ sio_detect.o \ sio_fdc37c665.o sio_fdc37c669.o sio_fdc37c932fr.o \ sio_pc87306.o sio_w83877f.o sio_um8669f.o piix.o \ keyboard.o \ keyboard_xt.o keyboard_at.o keyboard_pcjr.o \ keyboard_amstrad.o keyboard_olim24.o \ gameport.o \ joystick_standard.o joystick_ch_flightstick_pro.o \ joystick_sw_pad.o joystick_tm_fcs.o \ mouse.o \ mouse_serial.o mouse_ps2.o mouse_bus.o FDDOBJ := fdd.o fdc.o fdi2raw.o \ floppy.o floppy_common.o floppy_86f.o \ floppy_fdi.o floppy_imd.o floppy_img.o floppy_json.o \ floppy_td0.o HDDOBJ := hdd.o \ hdd_image.o hdd_table.o \ hdc.o \ hdc_esdi_at.o hdc_esdi_mca.o hdc_ide.o hdc_mfm_at.o \ hdc_mfm_xt.o hdc_xtide.o CDROMOBJ := cdrom.o \ cdrom_dosbox.o cdrom_image.o cdrom_null.o ifeq ($(USB), y) USBOBJ := usb.o endif SCSIOBJ := scsi.o \ scsi_bus.o scsi_device.o \ scsi_disk.o \ scsi_x54x.o \ scsi_buslogic.o scsi_aha154x.o \ scsi_ncr5380.o NETOBJ := network.o \ net_pcap.o \ net_slirp.o \ bootp.o ip_icmp.o misc.o socket.o tcp_timer.o cksum.o \ ip_input.o queue.o tcp_input.o debug.o ip_output.o \ sbuf.o tcp_output.o udp.o if.o mbuf.o slirp.o tcp_subr.o \ net_ne2000.o SNDOBJ := sound.o \ openal.o \ dbopl.o nukedopl.o \ snd_resid.o \ convolve.o convolve-sse.o envelope.o extfilt.o \ filter.o pot.o sid.o voice.o wave6581__ST.o \ wave6581_P_T.o wave6581_PS_.o wave6581_PST.o \ wave8580__ST.o wave8580_P_T.o wave8580_PS_.o \ wave8580_PST.o wave.o \ midi.o $(FSYNTHOBJ) $(MUNTOBJ) \ midi_system.o \ snd_speaker.o \ snd_ps1.o snd_pssj.o \ snd_lpt_dac.o snd_lpt_dss.o \ snd_adlib.o snd_adlibgold.o snd_ad1848.o snd_audiopci.o \ snd_sb.o snd_sb_dsp.o snd_cms.o snd_dbopl.o \ snd_emu8k.o snd_gus.o snd_opl.o \ snd_mpu401.o \ snd_sn76489.o snd_ssi2001.o snd_wss.o \ snd_ym7128.o VIDOBJ := video.o \ vid_table.o \ vid_cga.o vid_cga_comp.o vid_mda.o \ vid_ega.o vid_ega_render.o \ vid_vga.o vid_svga.o vid_svga_render.o \ vid_hercules.o vid_herculesplus.o vid_incolor.o \ vid_colorplus.o \ vid_genius.o \ vid_s3.o vid_s3_virge.o \ vid_et4000.o vid_et4000w32.o vid_icd2061.o \ vid_oti067.o \ vid_paradise.o \ vid_tvga.o vid_tgui9440.o vid_tkd8001_ramdac.o \ vid_ati_eeprom.o vid_ati18800.o vid_ati28800.o \ vid_ati68860_ramdac.o vid_ati_mach64.o \ vid_ics2595.o \ vid_sc1502x_ramdac.o \ vid_sdac_ramdac.o \ vid_stg_ramdac.o \ vid_wy700.o \ vid_voodoo.o \ vid_pcjr.o \ vid_ps1_svga.o \ vid_olivetti_m24.o \ vid_pc1512.o vid_pc1640.o \ vid_pc200.o \ vid_tandy.o vid_tandysl.o PLATOBJ := win.o \ win_ddraw.o win_ddraw_fs.o win_d3d.o win_d3d_fs.o \ $(VNCOBJ) $(RDPOBJ) \ win_dynld.o win_thread.o $(WSERIAL) win_cdrom.o win_cdrom_ioctl.o \ win_keyboard.o win_mouse.o win_joystick.o win_midi.o \ win_dialog.o win_about.o win_status.o win_stbar.o \ win_settings.o win_deviceconfig.o win_joystickconfig.o \ $(OPENDIR) OBJ := $(MAINOBJ) $(CPUOBJ) $(MCHOBJ) $(DEVOBJ) \ $(FDDOBJ) $(CDROMOBJ) $(HDDOBJ) \ $(USBOBJ) $(NETOBJ) $(SCSIOBJ) $(SNDOBJ) $(VIDOBJ) \ $(PLATOBJ) $(DEVBROBJ) ifdef EXOBJ OBJ += $(EXOBJ) endif LZFOBJ := lzf_c.o lzf_d.o LIBS := -mwindows \ -lopenal.dll \ -lddraw -ldinput8 -ldxguid -ld3d9 -ld3dx9 \ -lcomctl32 -lwinmm ifeq ($(VNC), y) LIBS += $(VNCLIB) -lws2_32 -lz -lpthread endif LIBS += -lkernel32 -lwsock32 -liphlpapi -lpsapi LIBS += -static -lstdc++ -lgcc LIBS += -Wl,--large-address-aware # Build module rules. ifeq ($(AUTODEP), y) %.o: %.c @echo $< @$(CC) $(CFLAGS) $(DEPS) -c $< %.o: %.cc @echo $< @$(CPP) $(CFLAGS) $(DEPS) -c $< %.o: %.cpp @echo $< @$(CPP) $(CFLAGS) $(DEPS) -c $< else %.o: %.c @echo $< @$(CC) $(CFLAGS) -c $< %.o: %.cc @echo $< @$(CPP) $(CFLAGS) -c $< %.o: %.cpp @echo $< @$(CPP) $(CFLAGS) -c $< %.d: %.c $(wildcard $*.d) @echo $< @$(CC) $(CFLAGS) $(DEPS) -E $< >NUL %.d: %.cc $(wildcard $*.d) @echo $< @$(CPP) $(CFLAGS) $(DEPS) -E $< >NUL %.d: %.cpp $(wildcard $*.d) @echo $< @$(CPP) $(CFLAGS) $(DEPS) -E $< >NUL endif all: $(PROG).exe pcap_if.exe 86Box.res: 86Box.rc @echo Processing $< @$(WINDRES) $(RFLAGS) $(EXTRAS) -i $< -o 86Box.res $(PROG).exe: $(OBJ) $(LZFOBJ) 86Box.res @echo Linking $(PROG).exe .. @$(CC) -o $(PROG).exe $(OBJ) $(LZFOBJ) 86Box.res $(LIBS) ifneq ($(DEBUG), y) @strip $(PROG).exe endif pcap_if.res: pcap_if.rc @echo Processing $< @$(WINDRES) $(RFLAGS) -i $< -o pcap_if.res pcap_if.exe: pcap_if.o win_dynld.o pcap_if.res @echo Linking pcap_if.exe .. @$(CC) -o pcap_if.exe pcap_if.o win_dynld.o pcap_if.res ifneq ($(DEBUG), y) @strip pcap_if.exe endif clean: @echo Cleaning objects.. @-rm *.o 2>NUL @-rm *.res 2>NUL clobber: clean @echo Cleaning executables.. @-rm *.d 2>NUL @-rm *.exe 2>NUL # @-rm *.depends 2>NUL ifneq ($(AUTODEP), y) depclean: @-rm -f .depends 2>NUL @echo Creating dependencies.. @echo # Run "make depends" to re-create this file. >.depends depends: DEPOBJ=$(OBJ:%.o=%.d) depends: depclean $(OBJ:%.o=%.d) @-cat $(DEPOBJ) >>.depends @-rm -f $(DEPOBJ) .depends: endif # Module dependencies. ifeq ($(AUTODEP), y) #-include $(OBJ:%.o=%.d) (better, but sloooowwwww) -include *.d else include $(wildcard .depends) endif # End of Makefile.mingw.