greg@455: #! gmake greg@455: greg@455: # greg@455: # Copyright (C) 2006 Laurent Bessard greg@455: # greg@455: # This file is part of canfestival, a library implementing the canopen greg@455: # stack greg@455: # greg@455: # This library is free software; you can redistribute it and/or greg@455: # modify it under the terms of the GNU Lesser General Public greg@455: # License as published by the Free Software Foundation; either greg@455: # version 2.1 of the License, or (at your option) any later version. greg@455: # greg@455: # This library is distributed in the hope that it will be useful, greg@455: # but WITHOUT ANY WARRANTY; without even the implied warranty of greg@455: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU greg@455: # Lesser General Public License for more details. greg@455: # greg@455: # You should have received a copy of the GNU Lesser General Public greg@455: # License along with this library; if not, write to the Free Software greg@455: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA greg@455: # greg@455: greg@455: CC = SUB_CC greg@455: OPT_CFLAGS = -O2 greg@455: CFLAGS = SUB_OPT_CFLAGS greg@455: PROG_CFLAGS = SUB_PROG_CFLAGS greg@455: PREFIX = SUB_PREFIX greg@455: TARGET = SUB_TARGET greg@461: OS = SUB_OS_NAME greg@455: CAN_DRIVER = SUB_CAN_DRIVER greg@455: TIMERS_DRIVER = SUB_TIMERS_DRIVER greg@455: ENABLE_DLL_DRIVERS=SUB_ENABLE_DLL_DRIVERS hacking@674: CAN_DLL_CFLAGS=SUB_CAN_DLL_CFLAGS edouard@634: VSCAN_API_FILENAME=VSCAN_API_latest.zip greg@455: greg@455: # define target specific environment greg@460: ifeq ($(OS),CYGWIN) greg@455: DLL_TYPE=dll greg@460: CAN_VSCOM_DLL_FLAGS=-Wl,--export-all-symbols -Wl,--exclude-libs,ALL greg@464: endif greg@464: greg@464: ifeq ($(OS),MINGW32) greg@464: DLL_TYPE=dll greg@464: CAN_VSCOM_DLL_FLAGS=-Wl,--export-all-symbols -Wl,--exclude-libs,ALL greg@464: endif greg@464: greg@464: ifeq ($(OS),Linux) greg@455: DLL_TYPE=so greg@460: CAN_VSCOM_DLL_FLAGS=-Wl,-soname,libcanfestival_$(CAN_DRIVER).so greg@455: endif greg@455: greg@455: INCLUDES = -I../../include -I../../include/$(TARGET) -I../../include/$(CAN_DRIVER) greg@455: greg@455: OBJS = $(CAN_DRIVER).o greg@455: greg@455: ifeq ($(ENABLE_DLL_DRIVERS),1) greg@455: CFLAGS += -fPIC greg@455: DRIVER = libcanfestival_$(CAN_DRIVER).$(DLL_TYPE) greg@455: else greg@455: DRIVER = $(OBJS) greg@455: endif greg@455: s@790: TARGET_SOFILES = $(DESTDIR)$(PREFIX)/lib/$(DRIVER) greg@455: greg@455: all: driver greg@455: greg@455: vs_can_api.h: edouard@634: wget http://www.vscom.de/download/multiio/linux/driver/${VSCAN_API_FILENAME} greg@455: @if which unzip &> /dev/null; then \ hacking@674: unzip -o ${VSCAN_API_FILENAME}; \ greg@455: else \ edouard@634: echo "No unzip found. Please decompress ${VSCAN_API_FILENAME} manually"; \ greg@455: exit 1; \ greg@455: fi; greg@455: greg@455: driver: vs_can_api.h $(DRIVER) greg@455: Christian@658: %.o: %.c greg@455: $(CC) $(CFLAGS) $(PROG_CFLAGS) ${PROGDEFINES} $(INCLUDES) -o $@ -c $< greg@455: greg@455: libcanfestival_$(CAN_DRIVER).$(DLL_TYPE): $(OBJS) greg@461: $(CC) $(PROG_CFLAGS) -shared $(CAN_VSCOM_DLL_FLAGS) -o $@ $< $(CAN_DLL_CFLAGS) greg@455: greg@455: install: libcanfestival_$(CAN_DRIVER).so s@790: mkdir -p $(DESTDIR)$(PREFIX)/lib/ s@790: cp $< $(DESTDIR)$(PREFIX)/lib/ hacking@674: greg@455: uninstall: greg@455: rm -f $(TARGET_SOFILES) greg@455: greg@455: clean: greg@455: rm -f $(OBJS) edouard@634: rm -f *.zip *.a *.so *.dll *.h *.lib edouard@634: rm -f CHANGES.TXT greg@455: greg@455: mrproper: clean