# # Name: Makehead.cygwin # # Purpose: This file is used to customize operating system and installation # dependent features of the MX makefiles. This version is customized # for Cygwin under Microsoft Windows. # # Cygwin may be found at http://www.cygwin.com/ # # Note: MX will not compile under Cygwin unless Sun RPC development # libraries are installed. For old versions of Cygwin, this # required that the 'sunrpc' package be installed. Newer versions # of Cygwin require the 'libtirpc-dev' package instead. # # Normally, the only things that end users may have to modify in this file are # the definitions of INCLUDES, LIB_DIRS, and LIBRARIES. # INCLUDES = $(MX_INCLUDES) # LIB_DIRS = -L$(MX_LIB_DIR) LIBRARIES = # #======================================================================== # # Generally, you should not have to modify anything after this point. # # # For older versions of Cygwin, we need to add rpclib to the linker # command line, so we test for the existence of /usr/lib/librpclib.a # HAS_CYGWIN_RPCLIB = $(shell ls -1 /usr/lib/librpclib.a 2>> /dev/null | wc -l ) ifeq ($(HAS_CYGWIN_RPCLIB),1) LIBRARIES += -lrpclib endif # # For newer versions of Cygwin, we need to add tirpc to the linker # command line, so we test for the existence of /usr/lib/libtirpc.dll.a # HAS_CYGWIN_TIRPC = $(shell ls -1 /usr/lib/libtirpc.dll.a 2>> /dev/null | wc -l ) ifeq ($(HAS_CYGWIN_TIRPC),1) LIBRARIES += -ltirpc endif # # gcc specific flags # GCCFLAGS = -Wall -Werror \ -Wstrict-prototypes \ -Wpointer-arith \ -Wcast-align \ -Wcast-qual \ -Wshadow \ -Wmissing-prototypes \ -Wnested-externs \ -Winline #-------------------------------------------------------------------------- # # Modify GCCFLAGS depending on the version of GCC. # # For some reason, using 'test' here and then testing below for equality # with '0' does not work. # # _have_mx_config := $(shell test -x ../tools/mx_config ; echo \$\? ) # # However, using ../scripts/file_exists _does_ work. Note that # file_exists returns true or false rather than 0 or 1. # _have_mx_config := $(shell ../scripts/file_exists ../tools/mx_config ) ifeq ($(_have_mx_config),true) _gccver := $(shell ../tools/mx_config gcc ) _need_no_unused_but_set_variable := $(shell expr $(_gccver) \> 4006000 ) ifeq ($(_need_no_unused_but_set_variable),1) GCCFLAGS += -Wno-unused-but-set-variable endif endif #-------------------------------------------------------------------------- # # Intel x86 or amd64 with Cygwin under Microsoft Windows. # CC = gcc CFLAGS = -g -O $(GCCFLAGS) $(INCLUDES) -I/usr/include/tirpc \ -DOS_CYGWIN -D_GNU_SOURCE $(EXTRA_FLAGS) -DDEBUG # Special cases for individual files. CFLAGS_MX_VERS = -DOS_CYGWIN -D_GNU_SOURCE \ -DMX_MAJOR_VERSION=$(MX_MAJOR_VERSION) \ -DMX_MINOR_VERSION=$(MX_MINOR_VERSION) \ -DMX_UPDATE_VERSION=$(MX_UPDATE_VERSION) \ -DMX_BRANCH_LABEL="\"$(MX_BRANCH_LABEL)\"" COMPILE = $(CC) -c DEFINE = -D MAKEDEPEND = gcc -MM $(CFLAGS) $(READLINE_INCLUDES) \ *.c > Makefile.depend MAKEDEPEND_CLEAN = rm Makefile.depend # #--------------------------------------------------- # # Declare bundled programs to be MX "applications". # One of the consequences of this is that mx_poison.h # is applied to them. # APP_FLAGS=$(DEFINE)__MX_APP__ # #--------------------------------------------------- # MX_LIB_SRCS = mx_driver.c $(MX_CORE_SRCS) $(MX_DRIVER_SRCS) # # See libMx/Makehead.irix for why this is here. # MX_LIB_OBJS = $(MX_LIB_SRCS:.c=.$(OBJ)) MOTOR_OBJS = $(MOTOR_SRCS:.c=.$(OBJ)) SERVER_OBJS = $(SERVER_SRCS:.c=.$(OBJ)) AUTOSAVE_OBJS = $(AUTOSAVE_SRCS:.c=.$(OBJ)) MXDRIVERINFO_OBJS = $(MXDRIVERINFO_SRCS:.c=.$(OBJ)) MXMONITOR_OBJS = $(MXMONITOR_SRCS:.c=.o) MXGET_OBJS = $(MXGET_SRCS:.c=.o) MXPUT_OBJS = $(MXPUT_SRCS:.c=.o) #---- MX_LIB_OBJS += ../tools/xdr_hyper.o MX_LIB_OBJS += ../tools/strcasestr.o MX_LIB_OBJS += ../tools/cJSON.o # #--------------------------------------------------- # RM = rm -f MAKE = make TOUCH = touch -a OBJ = o EXEOUT = -o DOTEXE = # #--------------------------------------------------- # MX_LIB_DIR = ../libMx MX_INC_DIR = $(MX_LIB_DIR) MX_INCLUDES = -I$(MX_INC_DIR) MX_LIBRARY_PATH = $(MX_LIB_DIR)/$(MX_LIBRARY_NAME) MX_LIBRARY_NAME = libMx.a MX_LIBRARY_STATIC_NAME = $(MX_LIBRARY_NAME) MX_LIBRARY_DELETE = $(RM) libMx* $(MX_LIBRARY_NAME): $(MX_LIB_OBJS) -$(MX_LIBRARY_DELETE) ar rcs libMx.a $(MX_LIB_OBJS) ranlib libMx.a dllwrap -o libMx.dll --export-all-symbols \ --output-lib libMx.dll.a \ $(LIB_DIRS) $(MX_LIB_OBJS) $(LIBRARIES) library_install: -mkdir $(MX_INSTALL_DIR)/bin -mkdir $(MX_INSTALL_DIR)/etc -mkdir $(MX_INSTALL_DIR)/etc/startup -mkdir $(MX_INSTALL_DIR)/include -mkdir $(MX_INSTALL_DIR)/lib -mkdir $(MX_INSTALL_DIR)/log -mkdir $(MX_INSTALL_DIR)/run -mkdir $(MX_INSTALL_DIR)/sbin -mkdir $(MX_INSTALL_DIR)/state install -m 644 mx*.h $(MX_INSTALL_DIR)/include install -m 644 ../tools/cJSON/cJSON.h $(MX_INSTALL_DIR)/include install -m 644 $(MX_LIBRARY_NAME) $(MX_INSTALL_DIR)/lib touch $(MX_INSTALL_DIR)/etc/mxmotor.dat touch $(MX_INSTALL_DIR)/etc/mxscan.dat install -m 755 ../plotgnu/plotgnu.pl $(MX_INSTALL_DIR)/bin install -m 755 ../plotgnu/showdata $(MX_INSTALL_DIR)/bin/showdata.pl install -m 755 ../plotgnu/showplot $(MX_INSTALL_DIR)/bin/showplot.pl install -m 755 ../plotgnu/plot2ps $(MX_INSTALL_DIR)/bin/plot2ps.pl install -m 755 ../scripts/mxsetup.sh $(MX_INSTALL_DIR)/bin/mxsetup.sh install -m 755 ../tools/mx_config $(MX_INSTALL_DIR)/bin install -m 755 libMx.dll $(MX_INSTALL_DIR)/bin install -m 644 libMx.dll.a $(MX_INSTALL_DIR)/lib mx_list_head.$(OBJ): Makefile.version mx_list_head.c mx_version.h $(COMPILE) $(CFLAGS) -DMX_CFLAGS="${CFLAGS}" mx_list_head.c # #--------------------------------------------------- # MOTOR_NAME = mxmotor MOTOR_NAME2 = mxmotor.static $(MOTOR_NAME): $(MOTOR_OBJS) $(MX_LIBRARY_PATH) $(CC) $(CFLAGS) -o $(MOTOR_NAME) $(MOTOR_OBJS) \ $(LIB_DIRS) ../libMx/libMx.a $(LIBRARIES) -lreadline $(CC) $(CFLAGS) -o $(MOTOR_NAME2) $(MOTOR_OBJS) \ $(LIB_DIRS) -lMx $(LIBRARIES) -lreadline motor_install: install -m 755 $(MOTOR_NAME) $(MX_INSTALL_DIR)/bin install -m 755 $(MOTOR_NAME2) $(MX_INSTALL_DIR)/bin # #--------------------------------------------------- # SERVER_NAME = mxserver $(SERVER_NAME): $(SERVER_OBJS) $(MX_LIBRARY_PATH) $(CC) $(CFLAGS) -o $(SERVER_NAME) $(SERVER_OBJS) \ $(LIB_DIRS) -lMx $(LIBRARIES) server_install: install -m 755 $(SERVER_NAME) $(MX_INSTALL_DIR)/sbin install -m 755 ../scripts/startmxserver $(MX_INSTALL_DIR)/sbin install -m 755 ../scripts/mx $(MX_INSTALL_DIR)/sbin touch $(MX_INSTALL_DIR)/etc/mxserver.dat touch $(MX_INSTALL_DIR)/etc/mxserver.acl # #--------------------------------------------------- # AUTOSAVE_NAME = mxautosave $(AUTOSAVE_NAME): $(AUTOSAVE_OBJS) $(MX_LIBRARY_PATH) $(CC) $(CFLAGS) -o $(AUTOSAVE_NAME) $(AUTOSAVE_OBJS) \ $(LIB_DIRS) -lMx $(LIBRARIES) autosave_install: install -m 755 $(AUTOSAVE_NAME) $(MX_INSTALL_DIR)/sbin install -m 755 ../scripts/startmxautosave $(MX_INSTALL_DIR)/sbin install -m 755 ../scripts/mxsave $(MX_INSTALL_DIR)/bin install -m 755 ../scripts/mxrestore $(MX_INSTALL_DIR)/bin touch $(MX_INSTALL_DIR)/etc/mxautosave.dat # #--------------------------------------------------- # MXDRIVERINFO_NAME = mxdriverinfo $(MXDRIVERINFO_NAME): $(MXDRIVERINFO_OBJS) $(MX_LIBRARY_PATH) $(CC) $(CFLAGS) -o $(MXDRIVERINFO_NAME) \ $(MXDRIVERINFO_OBJS) $(LIB_DIRS) ../libMx/libMx.a $(LIBRARIES) #--- MXMONITOR_NAME = mxmonitor $(MXMONITOR_NAME): $(MXMONITOR_OBJS) $(MX_LIBRARY_PATH) $(CC) $(CFLAGS) -o $(MXMONITOR_NAME) \ $(MXMONITOR_OBJS) $(LIB_DIRS) -lMx $(LIBRARIES) #--- MXSERIAL_NAME = mxserial $(MXSERIAL_NAME): mxserial.o $(MX_LIBRARY_PATH) $(CC) $(CFLAGS) -o $(MXSERIAL_NAME) mxserial.o \ $(LIB_DIRS) -lMx $(LIBRARIES) mxserial.o: mxserial_fork.c $(CC) $(CFLAGS) -D__MX_APP__ -c mxserial_fork.c -o mxserial.o util_install: install -m 755 $(MXDRIVERINFO_NAME) $(MX_INSTALL_DIR)/bin install -m 755 $(MXMONITOR_NAME) $(MX_INSTALL_DIR)/bin install -m 755 $(MXSERIAL_NAME) $(MX_INSTALL_DIR)/bin install -m 755 $(MXGET_NAME) $(MX_INSTALL_DIR)/bin install -m 755 $(MXPUT_NAME) $(MX_INSTALL_DIR)/bin #--- MXGET_NAME = mxget $(MXGET_NAME): $(MXGET_OBJS) $(MX_LIBRARY_PATH) $(CC) $(CFLAGS) -o $(MXGET_NAME) \ $(MXGET_OBJS) $(LIB_DIRS) -lMx $(LIBRARIES) #--- MXPUT_NAME = mxput $(MXPUT_NAME): $(MXPUT_OBJS) $(MX_LIBRARY_PATH) $(CC) $(CFLAGS) -o $(MXPUT_NAME) \ $(MXPUT_OBJS) $(LIB_DIRS) -lMx $(LIBRARIES)