This repository has been archived by the owner on Mar 12, 2018. It is now read-only.
forked from kripken/box2d.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
85 lines (72 loc) · 3.04 KB
/
Makefile
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Makefile for generating a Box2D library using Emscripten.
# You'll likely need to edit these for your particular directory layout.
LLVM=/usr/bin
EMSCRIPTEN=$(PWD)/emscripten
# For placing path overrides.. this path is hidden from git
-include Makefile.local
ENV=LLVM=$(LLVM) EMSCRIPTEN=$(EMSCRIPTEN)
EMCC=$(ENV) $(EMSCRIPTEN)/emcc
PYTHON=$(ENV) python
O = Box2D_v2.2.1/Box2D
OBJECTS = \
$(O)/Collision/b2BroadPhase.bc \
$(O)/Collision/b2CollideCircle.bc \
$(O)/Collision/b2CollideEdge.bc \
$(O)/Collision/b2CollidePolygon.bc \
$(O)/Collision/b2Collision.bc \
$(O)/Collision/b2Distance.bc \
$(O)/Collision/b2DynamicTree.bc \
$(O)/Collision/b2TimeOfImpact.bc \
$(O)/Collision/Shapes/b2ChainShape.bc \
$(O)/Collision/Shapes/b2CircleShape.bc \
$(O)/Collision/Shapes/b2EdgeShape.bc \
$(O)/Collision/Shapes/b2PolygonShape.bc \
$(O)/Common/b2BlockAllocator.bc \
$(O)/Common/b2Draw.bc \
$(O)/Common/b2Math.bc \
$(O)/Common/b2Settings.bc \
$(O)/Common/b2StackAllocator.bc \
$(O)/Common/b2Timer.bc \
$(O)/Dynamics/b2Body.bc \
$(O)/Dynamics/b2ContactManager.bc \
$(O)/Dynamics/b2Fixture.bc \
$(O)/Dynamics/b2Island.bc \
$(O)/Dynamics/b2World.bc \
$(O)/Dynamics/b2WorldCallbacks.bc \
$(O)/Dynamics/Contacts/b2ChainAndCircleContact.bc \
$(O)/Dynamics/Contacts/b2ChainAndPolygonContact.bc \
$(O)/Dynamics/Contacts/b2CircleContact.bc \
$(O)/Dynamics/Contacts/b2Contact.bc \
$(O)/Dynamics/Contacts/b2ContactSolver.bc \
$(O)/Dynamics/Contacts/b2EdgeAndCircleContact.bc \
$(O)/Dynamics/Contacts/b2EdgeAndPolygonContact.bc \
$(O)/Dynamics/Contacts/b2PolygonAndCircleContact.bc \
$(O)/Dynamics/Contacts/b2PolygonContact.bc \
$(O)/Dynamics/Joints/b2DistanceJoint.bc \
$(O)/Dynamics/Joints/b2FrictionJoint.bc \
$(O)/Dynamics/Joints/b2GearJoint.bc \
$(O)/Dynamics/Joints/b2Joint.bc \
$(O)/Dynamics/Joints/b2MouseJoint.bc \
$(O)/Dynamics/Joints/b2PrismaticJoint.bc \
$(O)/Dynamics/Joints/b2PulleyJoint.bc \
$(O)/Dynamics/Joints/b2RevoluteJoint.bc \
$(O)/Dynamics/Joints/b2RopeJoint.bc \
$(O)/Dynamics/Joints/b2WeldJoint.bc \
$(O)/Dynamics/Joints/b2WheelJoint.bc \
$(O)/Rope/b2Rope.bc
all: box2d.js
%.bc: %.cpp
$(EMCC) -IBox2D_v2.2.1 $< -o $@
# Note: might need -xc++ on some compiler versions (no space)
box2d.clean.h:
cpp -x c++ -DEM_NO_LIBCPP -IBox2D_v2.2.1 root.h > box2d.clean.h
box2d_bindings.cpp: box2d.clean.h
$(PYTHON) $(EMSCRIPTEN)/tools/bindings_generator.py box2d_bindings box2d.clean.h -- '{ "ignored": "b2Shape::m_type,b2BroadPhase::RayCast,b2BroadPhase::UpdatePairs,b2BroadPhase::Query,b2DynamicTree::RayCast,b2DynamicTree::Query,b2ChainShape::m_nextVertex,b2ChainShape::m_hasNextVertex,b2EdgeShape::m_hasVertex3,b2EdgeShape::m_vertex2,b2EdgeShape::m_vertex3,b2Mat22,b2Mat33" }' > bindings.out
box2d_bindings.bc: box2d_bindings.cpp
$(EMCC) -IBox2D_v2.2.1 -include root.h $< -o $@
box2d.bc: $(OBJECTS) box2d_bindings.bc
$(LLVM)/llvm-link -o $@ $(OBJECTS) box2d_bindings.bc
box2d.js: box2d.bc
$(EMCC) -O2 -s ASM_JS=1 -s EXPORT_BINDINGS=1 -s RESERVED_FUNCTION_POINTERS=20 --js-transform "python bundle.py" $< -o $@
clean:
rm -f box2d.js box2d.bc $(OBJECTS) box2d_bindings.cpp box2d_bindings.bc box2d.clean.h