diff --git a/makefile b/makefile index c8b2cca7..f2e42d2e 100644 --- a/makefile +++ b/makefile @@ -9,7 +9,7 @@ # FreeBSD # HP-UX # AIX -# Windows (MinGW & cygwin) +# Windows (MinGW & cygwin) - deprecated (maybe works, maybe not) # Linux x86 targeting Android (using agcc script) # Haiku x86 (with gcc4) # @@ -103,6 +103,7 @@ endif SIM_MAJOR=$(shell grep SIM_MAJOR sim_rev.h | awk '{ print $$3 }') BUILD_SINGLE := ${MAKECMDGOALS} $(BLANK_SUFFIX) BUILD_MULTIPLE_VERB = is +MAKECMDGOALS_DESCRIPTION = the $(MAKECMDGOALS) simulator # building the pdp1, pdp11, tx-0, or any microvax simulator could use video support ifneq (3,${SIM_MAJOR}) ifneq (,$(or $(findstring XXpdp1XX,$(addsuffix XX,$(addprefix XX,${MAKECMDGOALS}))),$(findstring pdp11,${MAKECMDGOALS}),$(findstring tx-0,${MAKECMDGOALS}),$(findstring microvax1,${MAKECMDGOALS}),$(findstring microvax2,${MAKECMDGOALS}),$(findstring microvax3900,${MAKECMDGOALS}),$(findstring microvax2000,${MAKECMDGOALS}),$(findstring vaxstation3100,${MAKECMDGOALS}),$(findstring XXvaxXX,$(addsuffix XX,$(addprefix XX,${MAKECMDGOALS}))))) @@ -142,10 +143,7 @@ ifneq (,$(findstring pdp11,${MAKECMDGOALS})$(findstring pdp10,${MAKECMDGOALS})$( BUILD_MULTIPLE_VERB = are VIDEO_USEFUL = true BESM6_BUILD = true - endif - ifneq (,$(word 2,${MAKECMDGOALS})) - BUILD_MULTIPLE = s - BUILD_MULTIPLE_VERB = are + MAKECMDGOALS_DESCRIPTION = everything endif else ifeq (${MAKECMDGOALS},) @@ -156,8 +154,14 @@ else BUILD_MULTIPLE_VERB = are BUILD_SINGLE := all $(BUILD_SINGLE) BESM6_BUILD = true + MAKECMDGOALS_DESCRIPTION = everything endif endif +ifneq (,$(and $(word 1,${MAKECMDGOALS}),$(word 2,${MAKECMDGOALS}))) + BUILD_MULTIPLE = s + BUILD_MULTIPLE_VERB = are + MAKECMDGOALS_DESCRIPTION = the $(MAKECMDGOALS) simulators +endif # someone may want to explicitly build simulators without network support ifneq ($(NONETWORK),) NETWORK_USEFUL = @@ -167,6 +171,11 @@ ifneq ($(NOVIDEO),) VIDEO_USEFUL = endif ifneq ($(findstring Windows,${OS}),) + $(info *** Warning *** Compiling simh simulators with MinGW or cygwin is deprecated and) + $(info *** Warning *** may not complete successfully or produce working simulators. If) + $(info *** Warning *** building simulators completes, they may not be fully functional.) + $(info *** Warning *** It is recommended to use one of the free Microsoft Visual Studio) + $(info *** Warning *** compilers which provide fully functional simulator capabilities.) ifeq ($(findstring .exe,${SHELL}),.exe) # MinGW WIN32 := 1 @@ -183,6 +192,38 @@ endif find_exe = $(abspath $(strip $(firstword $(foreach dir,$(strip $(subst :, ,${PATH})),$(wildcard $(dir)/$(1)))))) find_lib = $(firstword $(abspath $(strip $(firstword $(foreach dir,$(strip ${LIBPATH}),$(foreach ext,$(strip ${LIBEXT}),$(wildcard $(dir)/lib$(1).$(ext)))))))) find_include = $(abspath $(strip $(firstword $(foreach dir,$(strip ${INCPATH}),$(wildcard $(dir)/$(1).h))))) +ifeq (/usr/local/bin/brew,$(shell which brew)) + PKG_MGR = HOMEBREW +else + ifeq (/opt/local/bin/port,$(shell which port)) + PKG_MGR = MACPORTS + endif +endif +ifneq (,$(and $(findstring Linux,$(shell uname)),$(call find_exe,apt-get))) + PKG_MGR = APT +endif +ifneq (,$(and $(findstring Linux,$(shell uname)),$(call find_exe,yum))) + PKG_MGR = YUM +endif +ifneq (,$(call find_exe,pkgin)) + PKG_MGR = PKGSRC +endif +# Dependent packages +DPKG_COMPILER = 1 +DPKG_PCAP = 2 +DPKG_VDE = 3 +DPKG_PCRE = 4 +DPKG_EDITLINE = 5 +DPKG_SDL = 6 +DPKG_PNG = 7 +DPKG_ZLIB = 8 +DPKG_SDL_TTF = 9 +# Platform Pkg Names COMPILER PCAP VDE PCRE EDITLINE SDL PNG ZLIB SDL_TTF +PKGS_SRC_HOMEBREW = - - vde pcre libedit sdl2 libpng zlib sdl2_ttf +PKGS_SRC_MACPORTS = - - vde2 pcre libedit libsdl2 libpng zlib libsdl2_ttf +PKGS_SRC_APT = gcc libpcap-dev libvdeplug-dev libpcre3-dev libedit-dev libsdl2-dev libpng-dev - libsdl2-ttf-dev +PKGS_SRC_YUM = gcc libpcap-devel - pcre-devel libedit-devel SDL2-devel libpng-devel zlib-devel SDL2_ttf-devel +PKGS_SRC_PKGSRC = - - - pcre editline SDL2 png zlib SDL2_ttf ifneq (3,${SIM_MAJOR}) ifneq (0,$(TESTS)) find_test = RegisterSanityCheck $(abspath $(wildcard $(1)/tests/$(2)_test.ini)) /dev/null| grep libvdeplug-dev)) - $(info *** Info *** $$ sudo apt-get install libvdeplug-dev) - else - $(info *** Info *** $$ sudo apt-get install vde2) - endif - else - $(info *** Info *** should read 0readme_ethernet.txt and follow the instructions) - $(info *** Info *** regarding the needed libvdeplug components for your $(OSNAME)) - $(info *** Info *** platform) - endif - endif - $(info *** Info ***) endif + else + NEEDED_PKGS += DPKG_VDE endif ifneq (,$(call find_include,linux/if_tun)) # Provide support for Tap networking on Linux @@ -991,17 +950,6 @@ ifeq (${WIN32},) #*nix Environments (&& cygwin) NETWORK_CCDEFS += -Islirp -Islirp_glue -Islirp_glue/qemu -DHAVE_SLIRP_NETWORK -DUSE_SIMH_SLIRP_DEBUG slirp/*.c slirp_glue/*.c NETWORK_LAN_FEATURES += NAT(SLiRP) endif - ifeq (,$(findstring USE_NETWORK,$(NETWORK_CCDEFS))$(findstring USE_SHARED,$(NETWORK_CCDEFS))$(findstring HAVE_VDE_NETWORK,$(NETWORK_CCDEFS))) - NETWORK_CCDEFS += -DUSE_NETWORK - NETWORK_FEATURES = - WITHOUT Local LAN networking support - $(info *** Warning ***) - $(info *** Warning *** $(BUILD_SINGLE)Simulator$(BUILD_MULTIPLE) $(BUILD_MULTIPLE_VERB) being built WITHOUT LAN networking support) - $(info *** Warning ***) - $(info *** Warning *** To build simulator(s) with networking support you should read) - $(info *** Warning *** 0readme_ethernet.txt and follow the instructions regarding the) - $(info *** Warning *** needed libpcap components for your $(OSTYPE) platform) - $(info *** Warning ***) - endif NETWORK_OPT = $(NETWORK_CCDEFS) endif ifneq (binexists,$(shell if ${TEST} -e BIN/buildtools; then echo binexists; fi)) @@ -1191,7 +1139,7 @@ else ifeq (,$(WINDOWS_BUILD)) WINDOWS_BUILD = 00000000 endif - ifneq (,$(or $(shell if 20190124 GTR $(WINDOWS_BUILD) echo old-windows-build),$(and $(shell if 20171112 GTR $(WINDOWS_BUILD) echo old-windows-build),$(findstring pthreadGC2,$(PTHREADS_LDFLAGS))))) + ifneq (,$(or $(shell if 20191001 GTR $(WINDOWS_BUILD) echo old-windows-build),$(and $(shell if 20171112 GTR $(WINDOWS_BUILD) echo old-windows-build),$(findstring pthreadGC2,$(PTHREADS_LDFLAGS))))) $(info .) $(info windows-build components at: $(abspath ..\windows-build)) $(info .) @@ -1234,6 +1182,68 @@ else CFLAGS_I = -DHAVE_NTDDDISK_H endif endif # Win32 (via MinGW) +USEFUL_PACKAGES = $(filter-out -,$(foreach word,$(NEEDED_PKGS),$(word $($(word)),$(PKGS_SRC_$(strip $(PKG_MGR)))))) +USEFUL_PLURAL = $(if $(word 2,$(USEFUL_PACKAGES)),s,) +USEFUL_MULTIPLE_HIST = $(if $(word 2,$(USEFUL_PACKAGES)),were,was) +USEFUL_MULTIPLE = $(if $(word 2,$(USEFUL_PACKAGES)),these,this) +ifneq (,$(USEFUL_PACKAGES)) + $(info ) + $(info *** Info ***) + $(info *** Info *** The simulator$(BUILD_MULTIPLE) you are building could provide more functionality) + $(info *** Info *** if the: $(USEFUL_PACKAGES)) + $(info *** Info *** package$(USEFUL_PLURAL) $(USEFUL_MULTIPLE_HIST) available on your system.) + $(info ) + $(info *** You have the option of building $(MAKECMDGOALS_DESCRIPTION) without the functionality) + $(info *** $(USEFUL_MULTIPLE) package$(USEFUL_PLURAL) provide$(if $(USEFUL_PLURAL),,s), or stopping now to install $(USEFUL_MULTIPLE) package$(USEFUL_PLURAL).) + $(info ) + $(info Do you want to install $(USEFUL_MULTIPLE) package$(USEFUL_PLURAL) before building $(MAKECMDGOALS_DESCRIPTION)?) +endif +ifneq (,$(and $(findstring HOMEBREW,$(PKG_MGR)),$(USEFUL_PACKAGES))) + ifeq (,$(shell bash -c 'read -p "[Enter Y or N, Default is Y] " answer; echo $$answer' | grep -i n)) + BREW_RESULT = $(shell brew install $(USEFUL_PACKAGES) 1>&2) + $(info $(BREW_RESULT)) + $(info *** rerunning this make to perform your desired build...) + MAKE_RESULT = $(shell $(MAKE) $(MAKECMDGOALS) 1>&2) + $(error Done: $(MAKE_RESULT)) + endif +else + ifneq (,$(and $(findstring MACPORTS,$(PKG_MGR)),$(USEFUL_PACKAGES))) + ifeq (,$(shell $(SHELL) -c 'read -p "[Enter Y or N, Default is Y] " answer; echo $$answer' | grep -i n)) + $(info Enter: $$ sudo port install $(USEFUL_PACKAGES)) + $(info when that completes) + $(info re-enter: $$ $(MAKE) $(MAKECMDGOALS)) + $(error ) + endif + endif +endif +ifneq (,$(and $(findstring APT,$(PKG_MGR)),$(USEFUL_PACKAGES))) + ifeq (,$(shell $(SHELL) -c 'read -p "[Enter Y or N, Default is Y] " answer; echo $$answer' | grep -i n)) + $(info Enter: $$ sudo apt-get install $(USEFUL_PACKAGES)) + $(info when that completes) + $(info re-enter: $$ $(MAKE) $(MAKECMDGOALS)) + $(error ) + endif +endif +ifneq (,$(and $(findstring YUM,$(PKG_MGR)),$(USEFUL_PACKAGES))) + ifeq (,$(shell $(SHELL) -c 'read -p "[Enter Y or N, Default is Y] " answer; echo $$answer' | grep -i n)) + $(info Enter: $$ sudo yum install $(USEFUL_PACKAGES)) + $(info when that completes) + $(info re-enter: $$ $(MAKE) $(MAKECMDGOALS)) + $(error ) + endif +endif +ifneq (,$(and $(findstring PKGSRC,$(PKG_MGR)),$(USEFUL_PACKAGES))) + ifeq (,$(shell $(SHELL) -c 'read -p "[Enter Y or N, Default is Y] " answer; echo $$answer' | grep -i n)) + $(info Enter: $$ su) + hash := \# + $(info Enter: Password: ) + $(info Enter: $(hash) pkgin install $(USEFUL_PACKAGES)) + $(info when that completes) + $(info Enter: $(hash) exit) + $(info re-enter: $$ $(MAKE) $(MAKECMDGOALS)) + $(error ) + endif +endif ifneq (,$(GIT_COMMIT_ID)) CFLAGS_GIT = -DSIM_GIT_COMMIT_ID=$(GIT_COMMIT_ID) endif