busconsole.mak 3.21 KB
Newer Older
1 2
PROJNAME= busconsole
APPNAME= $(PROJNAME)
3
CODEREV?= r$(shell svnversion -n $(PROJDIR))
4

5 6 7 8 9 10 11 12 13 14 15 16 17 18
SRC= \
  launcher.c \
  consolelibs.c \
  $(PRELOAD_DIR)/luaconsole.c

LUADIR= ../lua
LUASRC= \
  $(LUADIR)/openbus/console.lua

include ${LOOP_HOME}/openbus/base.mak

DEFINES= \
  OPENBUS_PROGNAME=\"$(APPNAME)\" \
  OPENBUS_CODEREV=\"$(CODEREV)\"
19

20
LIBS:= \
21
  luaopenbus \
22 23 24 25 26 27 28 29 30 31 32
  luastruct \
  luasocket \
  luatuple \
  loop \
  luacothread \
  luaidl \
  oil \
  luavararg \
  lfs \
  luuid \
  lce \
33
  luasec \
34 35 36
  luascs \
  sqlite3 \
  lsqlite3
37

38 39
INCLUDES+= . \
  $(SRCLUADIR) \
40
  $(LUASTRUCT_HOME)/src \
41
  $(LUASOCKET_HOME)/include \
42 43
  $(LUATUPLE_HOME)/obj/$(TEC_UNAME) \
  $(LOOP_HOME)/obj/$(TEC_UNAME) \
44
  $(LUACOTHREAD_HOME)/obj/$(TEC_UNAME) \
45 46
  $(LUAIDL_HOME)/obj/$(TEC_UNAME) \
  $(OIL_HOME)/obj/$(TEC_UNAME) \
47 48 49 50
  $(LUAVARARG_HOME)/src \
  $(LUAFILESYSTEM_HOME)/include \
  $(LUUID_HOME)/include \
  $(LCE_HOME)/include \
51
  $(LUASEC_HOME)/include \
52
  $(SCS_LUA_HOME)/obj/$(TEC_UNAME) \
53 54 55 56
  $(OPENBUS_LUA_HOME)/obj/$(TEC_UNAME) \
  $(SQLITE_HOME) \
  $(LSQLITE3_HOME)
  
57 58
LDIR+= \
  $(LUASTRUCT_HOME)/lib/$(TEC_UNAME) \
59
  $(LUASOCKET_HOME)/lib/$(TEC_UNAME) \
60
  $(LUATUPLE_HOME)/lib/$(TEC_UNAME) \
61
  $(LOOP_HOME)/lib/$(TEC_UNAME) \
62 63 64
  $(LUACOTHREAD_HOME)/lib/$(TEC_UNAME) \
  $(LUAIDL_HOME)/lib/$(TEC_UNAME) \
  $(OIL_HOME)/lib/$(TEC_UNAME) \
65 66 67 68
  $(LUAVARARG_HOME)/lib/$(TEC_UNAME) \
  $(LUAFILESYSTEM_HOME)/lib/$(TEC_UNAME) \
  $(LUUID_HOME)/lib/$(TEC_UNAME) \
  $(LCE_HOME)/lib/$(TEC_UNAME) \
69
  $(LUASEC_HOME)/lib/$(TEC_UNAME) \
70
  $(SCS_LUA_HOME)/lib/$(TEC_UNAME) \
71 72 73
  $(OPENBUS_LUA_HOME)/lib/$(TEC_UNAME) \
  $(SQLITE_HOME)/.libs \
  $(LSQLITE3_HOME)/dist
74

75 76 77 78 79 80
ifdef USE_LUA51
  INCLUDES+= $(LUACOMPAT52_HOME)/c-api $(LUACOMPAT52_HOME)/obj/$(TEC_UNAME)
  LDIR+= $(LUACOMPAT52_HOME)/lib/$(TEC_UNAME)
  LIBS+= luacompat52 luabit32 luacompat52c
endif

81
ifeq "$(TEC_SYSNAME)" "Linux"
82
  LFLAGS = -Wl,-E -lpthread
83 84
endif
ifeq "$(TEC_SYSNAME)" "SunOS"
85 86 87 88 89 90
  USE_CC=Yes
  CFLAGS= -g -KPIC -mt -D_REENTRANT
  ifeq ($(TEC_WORDSIZE), TEC_64)
    CFLAGS+= -m64
  endif
  LFLAGS= $(CFLAGS) -xildoff
91
endif
92

93 94 95 96 97 98 99 100
ifeq ($(findstring $(TEC_SYSNAME), Win32 Win64), )
  ifdef USE_STATIC
    SLIB:= $(foreach libname, $(LIBS) uuid ssl crypto, ${OPENBUS_HOME}/lib/lib$(libname).a)
    ifeq "$(TEC_SYSNAME)" "SunOS"
      LIBS:= rt nsl socket resolv
    else
      LIBS:= 
    endif
101
  else
102 103 104
    ifneq "$(TEC_SYSNAME)" "Darwin"
      LIBS+= uuid
    endif
105
  endif
106 107
endif

108
ifneq ($(findstring $(TEC_SYSNAME), Win32 Win64), )
109
  APPTYPE= console
110 111 112 113 114 115 116 117
  LIBS+= wsock32 rpcrt4
  ifneq ($(findstring dll, $(TEC_UNAME)), ) # USE_DLL
    ifdef DBG
      LIBS+= libeay32MDd ssleay32MDd
    else
      LIBS+= libeay32MD ssleay32MD
    endif
    LDIR+= $(OPENSSL_HOME)/lib/VC
118
  else
119 120 121 122 123 124
    ifdef DBG
      LIBS+= libeay32MTd ssleay32MTd
    else
      LIBS+= libeay32MT ssleay32MT
    endif
    LDIR+= $(OPENSSL_HOME)/lib/VC/static
125
  endif
126 127 128
else
  LIBS+= dl
endif
129 130 131 132 133 134 135 136 137

$(PRELOAD_DIR)/luaconsole.c $(PRELOAD_DIR)/luaconsole.h: $(LUAPRELOADER) $(LUASRC)
	$(LOOPBIN) $(LUAPRELOADER) -l "$(LUADIR)/?.lua" \
	                           -d $(PRELOAD_DIR) \
	                           -h luaconsole.h \
	                           -o luaconsole.c \
	                           $(LUASRC)

luaconsole.c: $(PRELOAD_DIR)/luaconsole.h
138
consolelibs.c: $(PRELOAD_DIR)/luaconsole.h