# # File: # Makefile # # Description: Makefile for JLAB 16 Channel Discriminator/Scaler VME Module # to build dsc2Lib.o libdsc2.a libdsc2.so # using a VME Controller running Linux or vxWorks # # # Uncomment DEBUG line, to include some 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 = libdsc2.a endif #ARCH=Linux# ifdef DEBUG CFLAGS += -Wall -g else CFLAGS += -O2 endif SRC = dsc2Lib.c HDRS = $(SRC:.c=.h) OBJ = $(SRC:.c=.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}/dsc2Lib.h $(LINUXVME_INC) endif clean: @rm -vf *.{o,a,so} echoarch: @echo "Make for $(ARCH)" .PHONY: clean echoarch