1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
# get user and architecture specific options
OS := $(shell uname -s)
TORCHDIR := $(shell cd ..; pwd)
include ../Makefile_options_$(OS)
CC_FILES := $(wildcard *.cc)
STATICOBJSDIR := $(OBJS_DIR)/static
STATICOBJS := $(foreach f,$(CC_FILES),$(OBJS_DIR)/static/$(patsubst %.cc,%.o,$(f)))
DYNAMICOBJS := $(foreach f,$(CC_FILES),$(OBJS_DIR)/dynamic/$(patsubst %.cc,%.o,$(f)))
DYNAMICOBJSDIR := $(OBJS_DIR)/dynamic
all: $(LIBTORCH) $(LIBSOTORCH)
soname: $(LIBSOTORCH)
$(LIBTORCH): $(STATICOBJS)
@echo "Archiving..."
$(AR) $(LIBTORCH) $(STATICOBJSDIR)/*.o
$(LIBSOTORCH): $(DYNAMICOBJS)
$(CC) -shared -Wl,-soname=libtorch.so.3 -o $(LIBSOTORCH) $(DYNAMICOBJSDIR)/*.o
$(OBJS_DIR)/static/%.o: %.cc
@echo $<
$(CC) $(CFLAGS_$(MODE)) $(INCS) -o $@ -c $<
$(OBJS_DIR)/dynamic/%.o: %.cc
@echo $<
$(CC) -fPIC $(CFLAGS_$(MODE)) $(INCS) -o $@ -c $<
distclean:
rm -f .deps_*
clean:
@echo "Remove objects file and dependencies..."
rm -Rf $(OBJS) $(LIBTORCH)
rm -f .deps_$(VERSION_KEY)
rm -f *.class
depend:
@echo "Tracking dependencies..."
rm -f .deps_$(VERSION_KEY)
echo ${CURDIR}
echo *.cc
for file in *.cc ; do printf "$(OBJS_DIR)/" >> .deps_$(VERSION_KEY); $(DEP) $(CFLAGS_$(MODE)) $(INCS) $$file >> .deps_$(VERSION_KEY); done
.deps_$(VERSION_KEY):
@echo ">>> Please do a 'make depend' <<<"
exit 10
ifneq ($(MAKECMDGOALS),distclean)
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),depend)
include .deps_$(VERSION_KEY)
endif
endif
endif
|