about summary refs log blame commit diff stats
path: root/Makefile
blob: c9ddf663580f584541bd8f15381f2b2dadfeb1bf (plain) (tree)
1
2
3
4
5
6
7
8
                 
 


                                            
 
                                                                     
 





















                                               


                                                 

                        

                                             

                        

                                             

                                                     
include config.mk

SRC = $(shell find src/ -type f -name '*.c')
OBJ = $(SRC:%=$(BUILD_DIR)/%.o)
H = include/uv_link_t.h

.PHONY: all static shared clean install-static install-shared install

all: static shared

static: $(SNAME)

shared: $(DNAME)

$(OBJ): config.mk

$(SNAME): $(OBJ)
	ar rcs $@ $?

$(DNAME): LDFLAGS += -shared
$(DNAME): $(OBJ)
	$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@

$(BUILD_DIR)/%.c.o: %.c
	mkdir -p '$(@D)'
	$(CC) -c -o $@ $(INCLUDES) $(CFLAGS) $<

clean:
	rm -rf $(SNAME) $(DNAME) $(BUILD_DIR)

install-header: $(H)
	install -d $(DESTDIR)$(INCLUDEDIR)
	install -m 644 $^ $(DESTDIR)$(INCLUDEDIR)

install-static: $(SNAME)
	install -d $(DESTDIR)$(LIBDIR)
	install -m 755 $^ $(DESTDIR)$(LIBDIR)

install-shared: $(DNAME)
	install -d $(DESTDIR)$(LIBDIR)
	install -m 755 $^ $(DESTDIR)$(LIBDIR)

install: install-header install-static install-shared