1########################################################## 2# GNU Make makefile for Doom Legacy 3# Makefile for musserver 1.4 4# 5# Copyright (C) 1998-2015 by Doom Legacy Team. 6# 7# This Makefile requires exports from the Main Makefile and 8# CANNOT be executed on it own. 9# 10# commands: 11# all : compile executable (default) 12# dirs : create dep, objs, bin directories 13# clean : delete objs and bin 14# install: install binaries to INSTALL_DIR 15# uninstall: install binaries from INSTALL_DIR 16########################################################## 17 18# SERV_BUILD_DIR is export from Main or Src Makefile 19ifndef SERV_BUILD_DIR 20 $(error SERV_BUILD_DIR not defined) 21endif 22 23# Invoke make with MAKE_OPTIONS= to specify another file or location. 24ifndef MAKE_OPTIONS 25 MAKE_OPTIONS = $(SERV_BUILD_DIR)make_options 26endif 27 28# Put user settings in this file, and they will be included with every 29# invocation of make. 30-include $(MAKE_OPTIONS) 31 32#openserver5 33# MUS_OS=SCOOS5 34#unixware2 35# MUS_OS=SCOUW2 36#unixware7 37# MUS_OS=SCOUW7 38 39ifdef DEBUG 40DEBUGFLG= -g3 41else 42DEBUGFLG= 43endif 44#CC = gcc 45 46CFLAGS:= 47# Machine architecture. 48ifdef ARCH 49 # if does not have leading -march, -mcpu, -mtune, or similar. 50 ifeq ($(filter -march% -mcpu% -mtune% -m%, $(strip $(ARCH))),) 51 # Apply to most general architecture compiler flag. 52 CFLAGS:=-march=$(ARCH) 53 $(warning Using ARCH as: $(CFLAGS) ) 54 else 55 # Looks like a complete switch, use it as is. 56 CFLAGS:=$(ARCH) 57 endif 58else 59 CFLAGS=-march=i586 60endif 61CFLAGS+= -Wall -O2 62 63LDFLAGS = 64#LDFLAGS = -static 65OPTOBJ= 66 67INCOPT = -I. -I../../ 68 69# Differences from Linux 70 71ifeq ($(SMIF), FREEBSD_X11) 72 CFLAGS = -Wall -O2 -m486 -I/usr/src/sys/i386/isa/sound -DFREEBSD 73 SUBDIR=freebsd 74else 75 SUBDIR=linux 76endif 77 78ifeq ($(MUS_OS), SCOOS5) 79# The differences from Linux 80# use this for an older GNU C 2.7.2 81#CFLAGS = -Wall -O2 -m486 -b elf -DSCOOS5 82# use this for EGCS 1.0.1 83CFLAGS = -Wall -O2 -mpentium -DSCOOS5 84LDFLAGS = 85OPTOBJ=usleep.o 86SUBDIR=openserver5 87endif 88 89ifeq ($(MUS_OS), SCOUW2) 90CFLAGS = -Wall -O2 -m486 -DSCOUW2 91LDFLAGS = 92OPTOBJ=usleep.o 93SUBDIR=unixware2 94endif 95 96ifeq ($(MUS_OS), SCOUW7) 97CC=cc 98CFLAGS = -O2 -K pentium -DSCOUW7 99LDFLAGS = 100OPTOBJ=usleep.o 101SUBDIR=unixware7 102endif 103 104 105############################################# 106# Nothing below this line should be changed # 107############################################# 108 109# Export SERV_BUILD_DIR from parent Make. 110BIN:=$(SERV_BUILD_DIR)bin 111O:=$(SERV_BUILD_DIR)objs/mus_$(SUBDIR) 112 113MUSOBJLIST:=musserver.o readwad.o playmus.o sequencer.o ../m_swap.o $(OPTOBJ) 114MUSOBJ:=$(addprefix $(O)/, $(MUSOBJLIST)) 115 116all: $(BIN)/musserver 117 118$(BIN)/musserver: $(MUSOBJ) 119 ${CC} ${DEBUGFLG} ${CFLAGS} ${LDFLAGS} $(MUSOBJ) -o $(BIN)/musserver 120 121clean: 122 rm -f $(O)/* 123 124ifeq ("$(wildcard $(O))","") 125 # Missing obj dir 126 $(MUSOBJ) : | dirs 127endif 128 129dirs: 130 mkdir -p $(O) 131 132$(O)/%.o: %.c 133 ${CC} ${DEBUGFLG} ${CFLAGS} ${INCOPT} -c $< -o $@ 134 135#======================================================= 136# Install binaries 137 138install: 139 $(INSTALL) $(INSTALL_OPTS) -t $(INSTALL_DIR) $(BIN)/musserver 140 141uninstall: 142 - cd $(INSTALL_DIR) && $(RMFILE) musserver 143 144########################################################## 145