#----------------------------------------------------------------------------- # Copyright (c) 2015 Southeastern Universities Research Association, # Continuous Electron Beam Accelerator Facility # # This software was developed under a United States Government license # described in the NOTICE file included as part of this distribution. # # CEBAF Data Acquisition Group, 12000 Jefferson Ave., Newport News, VA 23606 # Email: coda@cebaf.gov Tel: (804) 249-7101 Fax: (804) 249-7363 # ----------------------------------------------------------------------------- # # Description: Makefile for Master Oscillator Distribution Module # # Author: Bryan Moffit, TJANF Data Acquisition Group # DEBUG=1 ifndef ARCH ifdef LINUXVME_LIB ARCH=Linux else ARCH=VXWORKSPPC endif endif # Defs and build for VxWorks ifeq ($(ARCH),VXWORKSPPC) VXWORKS_ROOT = /site/vxworks/5.5/ppc/target DEFS = -mcpu=604 -DCPU=PPC604 -DVXWORKS -D_GNU_TOOL -mlongcall -fno-for-scope -fno-builtin -fvolatile -DVXWORKSPPC ifdef DEBUG DEFS += -Wall -g endif INCS = -I. -I$(VXWORKS_ROOT)/h -I$(VXWORKS_ROOT)/h/rpc -I$(VXWORKS_ROOT)/h/net CC = ccppc $(INCS) $(DEFS) LD = ldppc # explicit targets all: moLib.o clean: rm -f moLib.o moLib.o: moLib.c moLib.h $(CC) -c moLib.c endif # Defs and build for Linux ifeq ($(ARCH),Linux) LINUXVME_LIB ?= ${CODA}/linuxvme/lib LINUXVME_INC ?= ${CODA}/linuxvme/include CROSS_COMPILE = CC = $(CROSS_COMPILE)gcc AR = ar RANLIB = ranlib CFLAGS = -I. -I${LINUXVME_INC} -I/usr/include \ -L. -L${LINUXVME_LIB} ifdef DEBUG CFLAGS += -Wall -g else += -O2 endif OBJS = moLib.o LIBS = libmo.a all: $(LIBS) libmo.a: moLib.o $(CC) -fpic -shared $(CFLAGS) -o libmo.so moLib.c $(AR) ruv libmo.a moLib.o $(RANLIB) libmo.a clean distclean: @rm -f $(OBJS) $(LIBS) *.so *~ links: libmo.a ln -sf $(PWD)/libmo.a $(LINUXVME_LIB)/libmo.a ln -sf $(PWD)/libmo.so $(LINUXVME_LIB)/libmo.so ln -sf $(PWD)/moLib.h $(LINUXVME_INC)/moLib.h install: libmo.a @cp -v $(PWD)/libmo.a $(LINUXVME_LIB)/libmo.a @cp -v $(PWD)/libmo.so $(LINUXVME_LIB)/libmo.so @cp -v $(PWD)/moLib.h $(LINUXVME_INC)/moLib.h %: %.c libmo.a $(CC) $(CFLAGS) -o $@ $(@:%=%.c) $(LIBS_$@) -lrt -ljvme -lmo %.o: %.c $(CC) $(CFLAGS) -o $@ -c $< %.d: %.c $(CC) -M $(CFLAGS) $< > $@ -include $(DEPS) .PHONY: all clean distclean endif