# # Main makefile for creating a binary executable using shared # libraries. The environment variable specified by $(MAKE_VAR) # is used at runtime to locate the shared libraries. # ifndef OBJ_PATH OBJ_PATH=./obj/$(arch) endif ifndef MAKE_VAR MAKE_VAR=$${MAKE_ROOT} endif ifndef ARCH_DETECT ARCH_DETECT=$(MAKE_VAR)/make/arch endif ifndef SHLIB_EXEC_PATH SHLIB_EXEC_PATH=$(MAKE_VAR)/lib/$$arch/ endif ifndef BINARY # # if BIN_PATH is defined, put all binaries into # this common directory. # BINARY is the absolute path to the architecture dependent # binary, EXEC_BINARY is the relative path from the shell # script (the architecture-independent startup wrapper) to # the real binary. During startup, EXEC_BINARY is prefixed with # the directory where the shell script resides. ifdef BIN_PATH BINARY=$(BIN_PATH)/$(TARGET) EXEC_BINARY=$${arch}/$(TARGET) else # # if BIN_PATH is undefined, put the architecture specific binary # into the obj/ subdirectory of the local source code directory. # The name of the binary is chosen to be architecture-dependent in # this case. EXEC_BINARY is set to find this binary at runtime # accordingly. # BINARY=$(VPATH)obj/$(TARGET).$(arch) EXEC_BINARY=obj/$(TARGET).$$arch endif endif ifeq ($E,.exe) BINARY=$(VPATH)$(TARGET)$E endif ifndef BINARCH_SCRIPT BINARCH_SCRIPT=$(BINDIR)/arch endif VPATH_TARGET=$(TARGET)-bin bin: $(BIN_PATH) ${bin.ctor} $(VPATH_TARGET) exec-wrapper $(BINARCH_SCRIPT) ${bin.dtor} include $(MAKE_ROOT)/make/vpath.rules vpath_$(VPATH_TARGET): $(BINARY) ifndef OBJECTLIST_PARAMETERS OBJECTLIST_PARAMETERS=$(OBJS) endif $(BINARY): $(OBJS) -$(RM) $@ $(LD) $(OBJECTLIST_PARAMETERS) $(LIBPATH_PARAMETERS) $(LDFLAGS) $(EXTRALIBS) $(OUTPUT_BINARY)$(TARGETFILE_PARAMETER) $(LIBS) $(CC_LIBS) exec-wrapper:: ${exec-wrapper.ctor} $(BINDIR)$(TARGET) ${exec-wrapper.dtor} ifeq ($E,.exe) $(BINDIR)$(TARGET): else $(BINDIR)$(TARGET): cp $(MAKE_ROOT)/make/start-exec-arch $@ @chmod +x $@ endif # # Support components # creation of directory for the binary and `arch' script # ifndef BIN_PATH_RULE BIN_PATH_RULE=true $(BIN_PATH): -mkdir -p $@ endif $(BINDIR)/arch: $(MAKE_ROOT)/make/arch $(CP) $< $@ # # Other targets # binclean: -$(RM) $(TARGET) -$(RM) $(BINARY) clean:: binclean help:: help.bin-shared help.bin-shared: @ echo "Make targets from bin-shared.rules:" @ echo " bin .............. Create a binary $(BINARY)" @ echo " exec-wrapper ..... Create an architecture-independent invocator" @ echo makevars:: makevars.bin-shared makevars.bin-shared: @ echo 'Makevariables used by bin-shared.rules:' @ echo ' TARGET ........... Target to be created' @ echo ' BINARY ........... Name and path of true binary' @ echo ' (e.g., $${VPATH}/obj/$${TARGET}.$${arch}).' debug:: debug.bin-shared debug.bin-shared: @ echo 'Makevariables used by bin-shared.rules:' @ echo ' TARGET ........... $(TARGET)' @ echo ' BINARY ........... $(BINARY)' @ echo ' LD ............... $(LD)' @ echo ' LIBS ............. $(LIBS)' @ echo ' OBJS ............. $(OBJS)' @ echo ' OBJ_PATH ......... $(OBJ_PATH)' @ echo ' LDFLAGS .......... $(LDFLAGS)' @ echo ' EXTRALIBS ........ $(EXTRALIBS)'