etisserant@400: #! gmake etisserant@400: etisserant@400: # etisserant@400: # Copyright (C) 2006 Giuseppe Massimo Bertani and Laurent Bessard etisserant@400: # etisserant@400: # This file is part of canfestival, a library implementing the canopen etisserant@400: # stack etisserant@400: # etisserant@400: # This library is free software; you can redistribute it and/or etisserant@400: # modify it under the terms of the GNU Lesser General Public etisserant@400: # License as published by the Free Software Foundation; either etisserant@400: # version 2.1 of the License, or (at your option) any later version. etisserant@400: # etisserant@400: # This library is distributed in the hope that it will be useful, etisserant@400: # but WITHOUT ANY WARRANTY; without even the implied warranty of etisserant@400: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU etisserant@400: # Lesser General Public License for more details. etisserant@400: # etisserant@400: # You should have received a copy of the GNU Lesser General Public etisserant@400: # License along with this library; if not, write to the Free Software etisserant@400: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA etisserant@400: # etisserant@400: etisserant@400: CC = SUB_CC etisserant@400: OPT_CFLAGS = -O2 etisserant@400: CFLAGS = SUB_OPT_CFLAGS etisserant@400: PROG_CFLAGS = SUB_PROG_CFLAGS etisserant@400: PREFIX = SUB_PREFIX etisserant@400: TARGET = SUB_TARGET etisserant@400: CAN_DRIVER = SUB_CAN_DRIVER etisserant@400: TIMERS_DRIVER = SUB_TIMERS_DRIVER etisserant@400: ENABLE_DLL_DRIVERS = SUB_ENABLE_DLL_DRIVERS etisserant@400: CAN_DLL_CFLAGS = SUB_CAN_DLL_CFLAGS etisserant@400: OS_NAME = SUB_OS_NAME etisserant@400: etisserant@400: INCLUDES = -I../../include -I../../include/$(TARGET) -I../../include/$(CAN_DRIVER) etisserant@400: etisserant@400: OBJS = $(CAN_DRIVER).o etisserant@400: etisserant@400: #GMB: must detect if we are under cygwin (produces a DLL driver) etisserant@400: #or under a real unix machine (produces a .so driver) etisserant@400: ifeq ($(ENABLE_DLL_DRIVERS),1) etisserant@400: ifeq ($(OS_NAME),CYGWIN) etisserant@400: DRIVER = libcanfestival_$(CAN_DRIVER).dll etisserant@400: else etisserant@400: ifeq ($(TARGET),unix) etisserant@400: CFLAGS += -fPIC etisserant@400: DRIVER = libcanfestival_$(CAN_DRIVER).so etisserant@400: endif etisserant@400: endif etisserant@400: else etisserant@400: DRIVER = $(OBJS) etisserant@400: endif etisserant@400: s@790: TARGET_SOFILES = $(DESTDIR)$(PREFIX)/lib/$(DRIVER) etisserant@400: etisserant@400: all: driver etisserant@400: etisserant@400: driver: $(DRIVER) etisserant@400: Christian@658: %.o: %.c etisserant@400: $(CC) $(CFLAGS) $(PROG_CFLAGS) ${PROGDEFINES} $(INCLUDES) -o $@ -c $< etisserant@400: etisserant@400: $(DRIVER): $(OBJS) etisserant@400: $(CC) -shared -Wl,-soname,$(DRIVER) $(CAN_DLL_CFLAGS) -o $@ $< etisserant@400: etisserant@400: install: $(DRIVER) s@790: mkdir -p $(DESTDIR)$(PREFIX)/lib/ s@790: cp $< $(DESTDIR)$(PREFIX)/lib/ etisserant@400: etisserant@400: uninstall: etisserant@400: rm -f $(TARGET_SOFILES) etisserant@400: etisserant@400: clean: etisserant@502: rm -f $(OBJS) libcanfestival_$(CAN_DRIVER).so etisserant@400: etisserant@400: mrproper: clean