1# Makefile for xhomer 2 3# To build xhomer: 4# 5# 1. make clean 6# 2. make 7# 8# To make a new archive tarball, perform the following steps: 9# 10# 1. make clean 11# 2. make date 12# 3. make archive 13 14####### 15# The following must be set to Y 16 17PRO = Y 18 19####### 20# DGA auto-detection 21# 22# DGA is used for full-screen modes on XF86 X-servers. The following 23# should auto-detect DGA1 (older systems) or DGA2 (newer systems). 24# In case the auto-detection fails, the USE_DGA options immediately 25# below may be used to override the detected settings. This should 26# be done by setting one of "USE_DGA1" and "USE_DGA2" to "N" and the 27# other to "Y" or by setting both to "N" (most non-Linux systems). 28 29X11DIR = $(LOCALBASE) 30 31ifeq ($(X11DIR)/include/X11/extensions/xf86dga.h,$(wildcard $(X11DIR)/include/X11/extensions/xf86dga.h)) 32 ifeq ($(X11DIR)/include/X11/extensions/xf86dga1.h,$(wildcard $(X11DIR)/include/X11/extensions/xf86dga1.h)) 33 USE_DGA2 = Y 34 else 35 ifeq ($(X11DIR)/include/X11/extensions/xf86vmode.h,$(wildcard $(X11DIR)/include/X11/extensions/xf86vmode.h)) 36 USE_DGA1 = Y 37 endif 38 endif 39endif 40 41####### 42# Compile in support for DGA1 full-screen support 43# (set at most one DGA option to Y) 44 45# USE_DGA1 = Y 46# USE_DGA1 = N 47 48####### 49# Compile in support for DGA2 full-screen support 50# (set at most one DGA option to Y) 51 52# USE_DGA2 = Y 53# USE_DGA2 = N 54 55####### 56# Use MIT shared memory in X-windows (for better performance) 57 58USE_SHM = Y 59 60####### 61# Curses library (for texthomer only) 62# 63# "texthomer" works better with ncurses. This is usually the default 64# curses library for Linux, so this often has no effect, but if you 65# are using another platform, you may need to set this to the paths 66# where you have installed ncurses. 67NCURSESINC=/apps/gnu/include/ncurses 68NCURSESLIB=/apps/gnu/lib 69NCURSESLINK=-lcurses -ltermcap 70# NCURSESLINK=-lncurses -ltermcap 71 72####### 73# Setting this causes the emulated realtime clock to be 74# locked to the realtime clock on the host system. 75# Unset this only for testing purposes. 76 77USE_RTC = Y 78 79####### 80# Provide extra information in the X-window title bar 81# (at this point, this adds TLB hit statistics) 82 83# USE_EXTRA_STATUS = Y 84 85####### 86# Build id.rom and pro350.rom into executable 87# 88# If this option is not defined, then xhomer expects to find 89# id.rom and pro350.rom in the directory it was run from. 90 91USE_BUILTIN_ROMS = Y 92 93####### 94# Do not set the following feature. it is not fully 95# functional. 96 97# USE_LIMIT = Y 98 99################ 100# PDP11 features 101 102CCDEFS = -DMM_CACHE=8 103CCDEFS += -DPERF_MONITOR 104CCDEFS += $(CFLAGS) 105# Skip boundary conditions for shift operations in the fp 106# code. (No check for shift by 0 or >=64 if you define this.) 107# CCDEFS += -DF_SH_FAST 108# CCDEFS += -DTRACE 109# CCDEFS += -DIOTRACE 110 111# Set version variable (for later use by make archive) 112 113PRO_VERSION = `cat VERSION` 114 115########################## 116# C-Compiler configuration 117 118# All the rest of the flags in this section assume gcc 119#CC=gcc -Wall 120# -Wchar-subscripts -W -Wshadow -Wconversion 121# -Wtraditional -Wstrict-prototypes 122 123# This prevents "undesirable excess precision" on some machines, says gcc 124#CC += -ffloat-store 125 126# The 1st choice runs about 15% slower than the 2nd (-O3 -fomit-frame-pointer). 127# but it (re)compiles faster and unlike the second choice, it is debuggable. 128# CC += -g -O -fno-inline 129#CC += -O3 -Winline -fomit-frame-pointer 130 131# Some older gcc's need this on i386 to work around a bug. As long as 132# omit-frame-pointer is also set, it doesn't seem to hurt performance, so 133# uncomment it if you think your gcc might have the bug. 134# CC += -fno-strength-reduce 135# Here are some more options from the man page but didn't seem to help much. 136# CC += -finline-functions -ffast-math -fexpensive-optimizations 137 138CCDEFS += -DLOCAL=static -DGLOBAL=extern 139 140# Used by pdp11_rp.c and term_x11.c 141CCLINK = -lm 142 143TARGET = $(shell echo `uname -s`-`uname -r | cut -d . -f 1`) 144 145ifeq ($(PRO),Y) 146 CCDEFS += -DPRO 147 CCLINK += -lX11 148 149 # Some Pro features require extra libraries and defines 150 151 ifeq ($(USE_RTC),Y) 152 CCDEFS += -DRTC 153 endif 154 155 ifeq ($(USE_LIMIT),Y) 156 CCDEFS += -DLIMIT 157 endif 158 159 ifeq ($(USE_SHM),Y) 160 CCDEFS += -DSHM 161 CCLINK += -lXext 162 endif 163 164 ifeq ($(USE_DGA1),Y) 165 CCDEFS += -DDGA 166 CCLINK += -lXext 167 CCLINK += -lXxf86dga 168 CCLINK += -lXxf86vm 169 endif 170 171 ifeq ($(USE_DGA2),Y) 172 CCDEFS += -DDGA 173 CCDEFS += -DDGA2 174 CCLINK += -lXext 175 CCLINK += -lXxf86dga 176 endif 177 178 ifeq ($(USE_EXTRA_STATUS),Y) 179 CCDEFS += -DEXTRA_STATUS 180 endif 181 182 ifeq ($(USE_BUILTIN_ROMS),Y) 183 CCDEFS += -DBUILTIN_ROMS 184 endif 185 186 # Try this as the default place for X11 stuff and ncurses 187 188 CCINCS = -I$(X11DIR)/include 189 CCLIBS = -L$(X11DIR)/lib -L$(NCURSESLIB) 190 191 # But some vendors put things in non-standard places 192 193 ifeq ($(TARGET), HP-UX-A) 194 # HP-UX 9 195 CCINCS+=-I/usr/include/X11R5 196 CCLIBS+=-L/usr/lib/X11R5 197 else 198 ifeq ($(TARGET), HP-UX-B) 199 # HP-UX 10 200 CCINCS+=-I/usr/include/X11R6 201 CCLIBS+=-L/usr/lib/X11R6 202 else 203 ifeq ($(TARGET), SunOS-5) 204 CCINCS+=-I/usr/openwin/include 205 CCLIBS+=-L/usr/openwin/lib 206 CCLINK+=-lsocket -lnsl 207 endif 208 endif 209 endif 210endif 211 212ifeq ($(TARGET), SunOS-4) 213 CCDEFS+= -DSUNOS -D__USE_FIXED_PROTOTYPES__ -DEXIT_FAILURE=1 -DEXIT_SUCCESS=0 214endif 215 216################### 217# Files, Rules, etc 218 219SOURCES=$(shell /bin/ls pdp11*.c scp*.c pro*.c) 220SOURCES_XHOMER=$(SOURCES) $(shell /bin/ls term*x11.c) 221SOURCES_TEXTHOMER=$(SOURCES) term_curses.c 222SOURCES_DEPEND=$(SOURCES) $(shell /bin/ls term*x11.c term_curses.c) 223OBJECTS=$(SOURCES_XHOMER:%.c=%.o) 224OBJECTS_TEXTHOMER=$(SOURCES_TEXTHOMER:%.c=%.o) 225PGOBJECTS=$(SOURCES_XHOMER:%.c=%.pg.o) 226 227%.o: %.c; $(CC) -DINLINE=inline $(CCINCS) $(CCDEFS) -c $*.c -o $@ 228%.pg.o: %.c; $(CC) -DINLINE= -pg $(CCINCS) $(CCDEFS) -c $*.c -o $@ 229 230xhomer: $(OBJECTS) 231 $(CC) $^ $(CCLIBS) $(CCLINK) -o $@ 232 233xhomer.static: $(OBJECTS) 234 $(CC) $^ $(CCLIBS) $(CCLINK) -static -ldl -o $@ 235 strip $@ 236 237texthomer: $(OBJECTS_TEXTHOMER) 238 $(CC) $^ $(CCLIBS) $(NCURSESLINK) -lm -o $@ 239 240texthomer.static: $(OBJECTS_TEXTHOMER) 241 $(CC) $^ $(CCLIBS) $(NCURSESLINK) -lm -static -o $@ 242 strip $@ 243 244pdp11: $(OBJECTS) 245 $(CC) $^ $(CCLIBS) $(CCLINK) -o $@ 246 247pdp11pg: $(PGOBJECTS) 248 $(CC) -pg $^ $(CCLIBS) $(CCLINK) -o $@ 249 250saveit: pdp11 251 cp pdp11 pdp11-$(TARGET) 252 strip pdp11-$(TARGET) 253 254date: 255 make_version 256 @echo -n "#define PRO_VERSION \"" > pro_version.h 257 @echo -n `cat VERSION` >> pro_version.h 258 @echo "\"" >> pro_version.h 259 260archive: 261 make_archive 262 263clean: 264 -@rm -f *.o *~ xhomer xhomer.static texthomer texthomer.static convert_roms 265 266dep depend: 267 @egrep -e "# Dependencies" Makefile > /dev/null || \ 268 echo "# Dependencies" >> Makefile 269 sed '/^\#\ Dependencies/q' < Makefile > Makefile.New 270 $(CC) -MM $(CCINCS) $(CCDEFS) $(SOURCES_DEPEND) >> Makefile.New 271 mv Makefile Makefile.bak 272 mv Makefile.New Makefile 273 274############## 275# Dependencies 276pdp11_cpu.o: pdp11_cpu.c pdp11_defs.h sim_defs.h pro_defs.h pro_version.h \ 277 pro_config.h 278pdp11_fp.o: pdp11_fp.c pdp11_defs.h sim_defs.h pro_defs.h pro_version.h \ 279 pro_config.h 280pdp11_sys.o: pdp11_sys.c pdp11_defs.h sim_defs.h pro_defs.h pro_version.h \ 281 pro_config.h 282pro_2661kb.o: pro_2661kb.c pdp11_defs.h sim_defs.h pro_defs.h \ 283 pro_version.h pro_config.h 284pro_2661ptr.o: pro_2661ptr.c pdp11_defs.h sim_defs.h pro_defs.h \ 285 pro_version.h pro_config.h 286pro_clk.o: pro_clk.c pdp11_defs.h sim_defs.h pro_defs.h pro_version.h \ 287 pro_config.h 288pro_com.o: pro_com.c pdp11_defs.h sim_defs.h pro_defs.h pro_version.h \ 289 pro_config.h 290pro_digipad.o: pro_digipad.c pdp11_defs.h sim_defs.h pro_defs.h \ 291 pro_version.h pro_config.h 292pro_eq.o: pro_eq.c pdp11_defs.h sim_defs.h pro_defs.h pro_version.h \ 293 pro_config.h 294pro_init.o: pro_init.c pdp11_defs.h sim_defs.h pro_defs.h pro_version.h \ 295 pro_config.h 296pro_int.o: pro_int.c pdp11_defs.h sim_defs.h pro_defs.h pro_version.h \ 297 pro_config.h 298pro_kb.o: pro_kb.c pdp11_defs.h sim_defs.h pro_defs.h pro_version.h \ 299 pro_config.h 300pro_la50.o: pro_la50.c pdp11_defs.h sim_defs.h pro_defs.h pro_version.h \ 301 pro_config.h 302pro_lk201.o: pro_lk201.c pdp11_defs.h sim_defs.h pro_defs.h pro_version.h \ 303 pro_config.h pro_lk201.h 304pro_maint.o: pro_maint.c pdp11_defs.h sim_defs.h pro_defs.h pro_version.h \ 305 pro_config.h 306pro_mem.o: pro_mem.c pdp11_defs.h sim_defs.h pro_defs.h pro_version.h \ 307 pro_config.h 308pro_menu.o: pro_menu.c pdp11_defs.h sim_defs.h pro_defs.h pro_version.h \ 309 pro_config.h pro_lk201.h 310pro_null.o: pro_null.c pdp11_defs.h sim_defs.h pro_defs.h pro_version.h \ 311 pro_config.h 312pro_ptr.o: pro_ptr.c pdp11_defs.h sim_defs.h pro_defs.h pro_version.h \ 313 pro_config.h 314pro_rd.o: pro_rd.c pdp11_defs.h sim_defs.h pro_defs.h pro_version.h \ 315 pro_config.h 316pro_reg.o: pro_reg.c pdp11_defs.h sim_defs.h pro_defs.h pro_version.h \ 317 pro_config.h id.h pro350.h 318pro_rx.o: pro_rx.c pdp11_defs.h sim_defs.h pro_defs.h pro_version.h \ 319 pro_config.h 320pro_serial.o: pro_serial.c pdp11_defs.h sim_defs.h pro_defs.h \ 321 pro_version.h pro_config.h 322pro_vid.o: pro_vid.c pdp11_defs.h sim_defs.h pro_defs.h pro_version.h \ 323 pro_config.h 324scp.o: scp.c sim_defs.h pro_defs.h pro_version.h pro_config.h 325scp_tty.o: scp_tty.c sim_defs.h 326term_curses.o: term_curses.c pro_defs.h pro_version.h pro_config.h \ 327 pro_lk201.h term_fonthash_curses.c 328term_overlay_x11.o: term_overlay_x11.c pro_defs.h pro_version.h \ 329 pro_config.h pro_font.h 330term_x11.o: term_x11.c \ 331 pro_defs.h pro_version.h \ 332 pro_config.h pro_lk201.h 333