# # Description: Makefile for CAEN TDCs v1190 and v1290 # to build tdc1190Lib.o libtdc1190.a libtdc1190.so # # This driver is specific to VxWorks BSPs and must be compiled # with access to vxWorks headers. # # # Uncomment DEBUG line for debugging info ( -g and -Wall ) #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 CC = ccppc LD = ldppc DEFS = -mcpu=604 -DCPU=PPC604 -DVXWORKS -D_GNU_TOOL -mlongcall \ -fno-for-scope -fno-builtin -fvolatile -DVXWORKSPPC INCS = -I. -I$(VXWORKS_ROOT)/h -I$(VXWORKS_ROOT)/h/rpc -I$(VXWORKS_ROOT)/h/net CFLAGS = $(INCS) $(DEFS) endif #ARCH=VXWORKSPPC# # Defs and build for Linux ifeq ($(ARCH),Linux) LINUXVME_LIB ?= ../lib LINUXVME_INC ?= ../include CC = gcc AR = ar RANLIB = ranlib CFLAGS = -I. -I${LINUXVME_INC} -I/usr/include \ -L${LINUXVME_LIB} -L. -DLinux_vme LIBS = libtdc1190.a endif #ARCH=Linux# ifdef DEBUG CFLAGS += -Wall -g else CFLAGS += -O2 endif SRC = tdc1190.c HDRS = $(SRC:.c=.h) OBJ = $(SRC:.c=Lib.o) ifeq ($(ARCH),Linux) all: echoarch $(LIBS) else all: echoarch $(OBJ) endif $(OBJ): $(SRC) $(HDRS) $(CC) $(CFLAGS) -c -o $@ $(SRC) $(LIBS): $(OBJ) $(CC) -fpic -shared $(CFLAGS) -o $(@:%.a=%.so) $(SRC) $(AR) ruv $@ $< $(RANLIB) $@ ifeq ($(ARCH),Linux) links: $(LIBS) @ln -vsf $(PWD)/$< $(LINUXVME_LIB)/$< @ln -vsf $(PWD)/$(<:%.a=%.so) $(LINUXVME_LIB)/$(<:%.a=%.so) @ln -vsf ${PWD}/*Lib.h $(LINUXVME_INC) install: $(LIBS) @cp -v $(PWD)/$< $(LINUXVME_LIB)/$< @cp -v $(PWD)/$(<:%.a=%.so) $(LINUXVME_LIB)/$(<:%.a=%.so) @cp -v ${PWD}/tdc1190.h $(LINUXVME_INC) endif clean: @rm -vf *.{o,a,so} echoarch: @echo "Make for $(ARCH)" .PHONY: clean echoarch