2012-10-03 14:31:35 +02:00
|
|
|
BINR_PROGRAM=1
|
|
|
|
include ../../libr/config.mk
|
2015-02-22 21:01:46 +00:00
|
|
|
include ../../shlr/zip/deps.mk
|
2012-10-03 14:31:35 +02:00
|
|
|
|
2015-10-11 02:55:47 +03:00
|
|
|
ifeq (,$(findstring tcc,${CC}))
|
2015-09-25 15:53:29 +02:00
|
|
|
CFLAGS+=-pie
|
2015-10-08 12:03:33 +02:00
|
|
|
endif
|
2015-09-24 03:36:06 +02:00
|
|
|
CFLAGS+=-I$(LTOP)/include
|
2013-04-04 02:32:13 +02:00
|
|
|
|
2013-09-07 00:39:08 +02:00
|
|
|
ifeq (${COMPILER},emscripten)
|
|
|
|
EXT_EXE=.js
|
|
|
|
endif
|
2012-10-03 14:31:35 +02:00
|
|
|
|
2012-10-29 13:15:18 +01:00
|
|
|
ifeq ($(USE_RPATH),1)
|
2015-10-26 21:33:45 +00:00
|
|
|
LDFLAGS+=-Wl,-rpath "${LIBDIR}"
|
2012-10-29 13:15:18 +01:00
|
|
|
endif
|
|
|
|
|
2012-10-03 14:31:35 +02:00
|
|
|
OBJ+=${BIN}.o
|
|
|
|
BEXE=${BIN}${EXT_EXE}
|
|
|
|
|
2013-02-06 11:47:31 +01:00
|
|
|
LDFLAGS+=${DL_LIBS}
|
2017-08-25 03:16:26 -07:00
|
|
|
ifneq (${ANDROID},1)
|
2017-08-26 02:24:22 +02:00
|
|
|
ifneq (${OSTYPE},windows)
|
2017-08-25 03:16:26 -07:00
|
|
|
ifneq (${OSTYPE},linux)
|
|
|
|
ifneq ($(CC),cccl)
|
|
|
|
LDFLAGS+=-lpthread
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
2017-08-26 02:24:22 +02:00
|
|
|
endif
|
2014-04-19 01:23:04 +02:00
|
|
|
|
|
|
|
REAL_LDFLAGS=$(subst -shared,,$(LDFLAGS))
|
|
|
|
|
2014-03-02 00:47:05 +01:00
|
|
|
ifeq ($(ISLIB),1)
|
|
|
|
BEXE=$(BIN).$(EXT_SO)
|
2014-04-19 01:23:04 +02:00
|
|
|
REAL_LDFLAGS+=-shared
|
2014-03-02 00:47:05 +01:00
|
|
|
endif
|
2012-10-03 14:31:35 +02:00
|
|
|
#--------------------#
|
|
|
|
# Rules for programs #
|
|
|
|
#--------------------#
|
|
|
|
|
2018-10-22 15:10:29 +02:00
|
|
|
LDFLAGS+=-lm
|
2014-04-19 01:23:04 +02:00
|
|
|
# For some reason w32 builds contain -shared in LDFLAGS. boo!
|
|
|
|
|
2012-10-03 14:31:35 +02:00
|
|
|
ifneq ($(BIN)$(BINS),)
|
|
|
|
|
2018-10-22 19:57:45 +02:00
|
|
|
ifeq ($(OSTYPE),linux)
|
|
|
|
LDFLAGS+=-static
|
|
|
|
endif
|
|
|
|
|
2012-10-03 14:31:35 +02:00
|
|
|
all: ${BEXE} ${BINS}
|
|
|
|
|
2018-10-22 15:10:29 +02:00
|
|
|
ifeq ($(WITH_LIBR),1)
|
|
|
|
${BINS}: ${OBJS}
|
2018-10-22 19:57:45 +02:00
|
|
|
${CC} ${CFLAGS} $@.c ${OBJS} ../../libr/libr.a -o $@ $(LDFLAGS)
|
2018-10-22 15:10:29 +02:00
|
|
|
|
|
|
|
${BEXE}: ${OBJ} ${SHARED_OBJ}
|
2018-10-22 19:57:45 +02:00
|
|
|
${CC} ${CFLAGS} $+ -L.. -o $@ ../../libr/libr.a $(LDFLAGS)
|
2018-10-22 15:10:29 +02:00
|
|
|
else
|
|
|
|
|
2012-10-03 14:31:35 +02:00
|
|
|
${BINS}: ${OBJS}
|
|
|
|
ifneq ($(SILENT),)
|
|
|
|
@echo CC $@
|
|
|
|
endif
|
2018-10-22 15:10:29 +02:00
|
|
|
${CC} ${CFLAGS} $@.c ${OBJS} ${REAL_LDFLAGS} $(LINK) -o $@
|
2012-10-03 14:31:35 +02:00
|
|
|
|
2015-11-01 11:43:05 +01:00
|
|
|
# -static fails because -ldl -lpthread static-gcc ...
|
2012-10-03 14:31:35 +02:00
|
|
|
${BEXE}: ${OBJ} ${SHARED_OBJ}
|
|
|
|
ifneq ($(SILENT),)
|
|
|
|
@echo LD $@
|
|
|
|
endif
|
2018-10-22 15:10:29 +02:00
|
|
|
${CC} ${CFLAGS} $+ -L.. -o $@ $(REAL_LDFLAGS) $(LINK)
|
|
|
|
endif
|
2012-10-03 14:31:35 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Dummy myclean rule that can be overriden by the t/ Makefile
|
|
|
|
# TODO: move to config.mk ? it must be a precondition
|
|
|
|
myclean:
|
|
|
|
|
|
|
|
clean:: myclean
|
2013-09-07 01:35:11 +02:00
|
|
|
-rm -f ${OBJS} ${OBJ} ${BEXE}
|
2012-10-03 14:31:35 +02:00
|
|
|
|
|
|
|
mrproper: clean
|
|
|
|
-rm -f *.d
|
|
|
|
|
|
|
|
install:
|
|
|
|
cd ../.. && ${MAKE} install
|
|
|
|
|
|
|
|
.PHONY: all clean myclean mrproper install
|