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