Makefile.ALL 1.88 KB
#!gmake

ifndef SIMTOOLS
SIMTOOLS = ../../../..
endif

include $(SIMTOOLS)/makedefs

VPATH = ..

################################################################
# Include Files
################################################################
INCS   = -I. -I$(SIMTOOLS) -I$(SIMTOOLS)/common/misc

ifdef SIMOS
DEF1 = -DSIMOS
endif
DEFS = $(DEF1) $(DEF2) $(GLOBAL_DEFS)

CFLAGS	 += $(GLOBAL_CFLAGS) 
LDFLAGS += $(GLOBAL_LDFLAGS)
ifeq ($(CPU),ALPHA)
LDFLAGS+= -lnsl
endif
ifeq ($(CPU),SUN)
LDFLAGS +=  -lsocket -lnsl
endif


C_TARGETS = rmtaccessserver.o
TARGETS   = $(C_TARGETS)

ifdef SIMOS
ifeq ($(CPU),SGI)
GOAL = simos
endif
ifeq ($(CPU),SGIN32)
GOAL = simos
endif
ifeq ($(CPU),ALPHA)
GOAL = simos-alpha
endif
ifeq ($(CPU),SUN)
GOAL = simos-sun
endif
CC_OPTS      = $(CFLAGS) $(INCS) $(DEFS)


endif


default: warn
ifdef SIMOS
	@$(MAKE) -f ../Makefile.ALL  SIMOS=1 deps
	@$(MAKE) -f ../Makefile.ALL  SIMOS=1 INCLUDE_DEPS=1 $(GOAL)
endif

simos: rmtaccess

simos-sun: rmtaccess-sun

simos-alpha: rmtaccess-alpha

rmtaccess:  $(TARGETS)
	@echo "-> Building rmtaccess"
	$(CC) $(CC_OPTS) -o ../rmtaccess $(TARGETS) $(LDFLAGS)

rmtaccess-sun: $(TARGETS)
	@echo "-> Building rmtaccess-sun"
	$(CC) $(CC_OPTS) -o ../rmtaccess-sun $(TARGETS) $(LDFLAGS)

rmtaccess-alpha: $(TARGETS)
	@echo "-> Building rmtaccess-alpha"
	$(CC) $(CC_OPTS) -o ../rmtaccess $(TARGETS) -DSIM_ALPHA $(LDFLAGS)



warn:
	@echo ""
	@echo "Building rmtaccess"
	@echo "***************************"
	@echo "  DEFS :   `$(FORMAT) $(DEFS)`"
	@echo "  CFLAGS : `$(FORMAT) $(CFLAGS)`"
	@echo "  INCS : `$(FORMAT) $(INCS)`"
	@echo "  CPU : `$(FORMAT) $(CPU)`"
	@echo ""

$(C_TARGETS): %.o: $(SIMTOOLS)/apps/unix/rmtaccess/%.c
	@echo "Compiling  $(<F)"
	$(CC) $(CC_OPTS) -c $(SIMTOOLS)/apps/unix/rmtaccess/$*.c 

deps: ${TARGETS:.o=.d}

%.d: %.c
	@echo "Finding dependencies of $(<F)"
	@$(CC) -M $(CC_OPTS) $< > $@

ifdef INCLUDE_DEPS
include ${TARGETS:.o=.d}
endif