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