CANLIB=libipsec_ims | |
VERSION=1 | |
TARGET= $(CANLIB).so | |
SO_CFLAGS= -shared | |
CFLAGS?= -O2 | |
H_FILE = ${wildcard *.h} | |
CUR_SOURCE=${wildcard *.c} | |
CUR_OBJS=${patsubst %.c, %.o, $(CUR_SOURCE)} | |
all: $(TARGET) | |
install: install_headers | |
@mkdir -p $(DEST_DIR)/usr/lib | |
install -m 0644 $(CANLIB).so $(DEST_DIR)/usr/lib | |
install -m 0644 $(CANLIB).so.$(VERSION) $(DEST_DIR)/usr/lib | |
install_headers: | |
@mkdir -p $(DEST_DIR)/usr/include | |
install -m 0644 *.h $(DEST_DIR)/usr/include | |
%.o: %.c | |
$(CC) -Wall -fPIC $(CFLAGS) -c $^ -o $@ | |
$(TARGET).$(VERSION) : $(CUR_OBJS) | |
$(CC) -shared -nostartfiles -Wl,-soname,$@ $^ -o $@ $(LDFLAGS) -lpthread -lsncfg -llog | |
$(TARGET): $(CANLIB).so.$(VERSION) | |
ln -s $< $@ | |
.PHONY: clean | |
clean: | |
rm -f $(CANLIB).* $(CUR_OBJS) |