Lunatic: prepare Makefiles for synthesis build.

- libs and headers are expected in platform/Windows/* (not there yet)
- prefix Lua #includes with luajit-2.0/
- build bytecode objects with absolute path name (used for debug info)

git-svn-id: https://svn.eduke32.com/eduke32@4000 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-08-11 15:28:42 +00:00
parent 5f19fe63c0
commit e947f1fe87
6 changed files with 21 additions and 24 deletions

View file

@ -443,12 +443,15 @@ ivfrate$(EXESUFFIX): $(OBJ)/ivfrate.$o
#### Lunatic
# Create object files directly with luajit
$(OBJ)/luaJIT_BC_%.$o: $(SRC)/lunatic/%.lua
$(OBJ)/luaJIT_BC_%.$o: $(MAKEFILE_COMMON_DIR)/source/lunatic/%.lua
$(COMPILE_STATUS)
if $(LUAJIT) -bg $< $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
# Same thing for defs.ilua which I'm too reluctant to rename now:
$(OBJ)/luaJIT_BC_%.$o: $(SRC)/lunatic/%.ilua
# NOTE: The target path must match EXACTLY with that of the DEFS_BC_SIZE
# determination in Makefile.common, because it is embedded into the bytecode as
# debugging information.
$(OBJ)/luaJIT_BC_%.$o: $(MAKEFILE_COMMON_DIR)/source/lunatic/%.ilua
if $(LUAJIT) -bg $< $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
$(OBJ)/%.$o: $(SRC)/lunatic/%.c

View file

@ -2,7 +2,8 @@
## common definitions for Makefile, build/Makefile, source/enet/Makefile and
## source/jaudiolib/Makefile
MAKEFILE_COMMON:=$(lastword $(MAKEFILE_LIST))
# NOTE: make's 'dir' function keeps a trailing shash, the 'abspath' does not!
MAKEFILE_COMMON_DIR:=$(abspath $(dir $(lastword $(MAKEFILE_LIST))))
# Use colored output
PRETTY_OUTPUT ?= 1
@ -426,14 +427,14 @@ endif
# Set up target-specific headers and libs that work across all Makefiles
ifeq ($(PLATFORM),WINDOWS)
BASELIBDIRS+= -L$(abspath $(dir $(MAKEFILE_COMMON))platform/Windows/lib$(WINLIB))
BASECOMMONFLAGS+= -I$(abspath $(dir $(MAKEFILE_COMMON))platform/Windows/include)
BASELIBDIRS+= -L$(abspath $(MAKEFILE_COMMON_DIR)/platform/Windows/lib$(WINLIB))
BASECOMMONFLAGS+= -I$(abspath $(MAKEFILE_COMMON_DIR)/platform/Windows/include)
endif
ifeq ($(PLATFORM),DARWIN)
# include port and brew
BASELIBDIRS+= -L$(abspath $(dir $(MAKEFILE_COMMON))platform/Apple/lib) \
BASELIBDIRS+= -L$(abspath $(MAKEFILE_COMMON_DIR)/platform/Apple/lib) \
-L/opt/local/lib -L/usr/local/lib
BASECOMMONFLAGS+= -I$(abspath $(dir $(MAKEFILE_COMMON))platform/Apple/include) \
BASECOMMONFLAGS+= -I$(abspath $(MAKEFILE_COMMON_DIR)/platform/Apple/include) \
-I/opt/local/include -I/sw/include -I/usr/local/include
endif
ifeq ($(PLATFORM),GCW)
@ -445,25 +446,18 @@ endif
#### Lunatic development
# LuaJIT standalone interpreter executable:
LUAJIT=luajit
# for LJ headers:
LUAJIT_WIN_SRC:= f:/g/mod/luajit-2.0/src
LUAJIT:=luajit
ifneq ($(LUNATIC),0)
# FIXME: Lunatic doesn't build with inlining because of wacky include
# chains!
override DISABLEINLINING=1
ifeq ($(PLATFORM),WINDOWS)
BASECOMMONFLAGS+= -I$(LUAJIT_WIN_SRC)
else
BASECOMMONFLAGS+= -I/usr/local/include/luajit-2.0
endif
BASECOMMONFLAGS+= -I$(SRC)/lunatic -DLUNATIC
BASECOMMONFLAGS+= -I$(MAKEFILE_COMMON_DIR)/source/lunatic -DLUNATIC
# Determine size of defs.ilua bytecode once.
ifndef DEFS_BC_SIZE
DEFS_BC_SIZE := $(shell $(LUAJIT) -bg -t h source/lunatic/defs.ilua -)
DEFS_BC_SIZE := $(shell $(LUAJIT) -bg -t h $(MAKEFILE_COMMON_DIR)/source/lunatic/defs.ilua -)
DEFS_BC_SIZE := $(word 3, $(DEFS_BC_SIZE))
# Pass the bytecode size to the sub-makes, too.
export DEFS_BC_SIZE

View file

@ -3,7 +3,7 @@
#ifndef ENGINE_LUNATIC_H_
#define ENGINE_LUNATIC_H_
#include <lua.h>
#include <luajit-2.0/lua.h>
typedef struct

View file

@ -1,8 +1,8 @@
/* The Lunatic Interpreter, part of EDuke32. Common, engine-side stuff. */
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#include <luajit-2.0/lua.h>
#include <luajit-2.0/lualib.h>
#include <luajit-2.0/lauxlib.h>
#include "cache1d.h"
#include "osd.h"

View file

@ -5,8 +5,8 @@
#include <errno.h>
#include <string.h> // strerror
#include <lualib.h>
#include <lauxlib.h>
#include <luajit-2.0/lualib.h>
#include <luajit-2.0/lauxlib.h>
#include "build.h" // printext256

View file

@ -1,6 +1,6 @@
/* The Lunatic Interpreter, part of EDuke32. Editor stuff. */
#include <lualib.h>
#include <luajit-2.0/lualib.h>
#include "lunatic_m32.h"