Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 68 lines (56 sloc) 1.509 kB
e0d6430 @mimaki add mruby sources
mimaki authored
1 # makefile discription.
db99923 @matz build process restructured
matz authored
2 # basic build file for mruby library (Ruby part)
e0d6430 @mimaki add mruby sources
mimaki authored
3
4 # project-specific macros
5 # extension of the executable-file is modifiable(.exe .out ...)
6 BASEDIR = .
7 TARGET := mrblib
8 MLIB := $(TARGET).o
9 CLIB := $(TARGET).c
10 DLIB := $(TARGET).ctmp
11 RLIB := $(TARGET).rbtmp
761ed34 @bovi Add dependency file to 'clean' target
bovi authored
12 DEPLIB := $(TARGET).d
e0d6430 @mimaki add mruby sources
mimaki authored
13 MRB1 := $(BASEDIR)/*.rb
14 MRBS := $(MRB1)
15
16 # C compiler (gcc)
17 CC = gcc
975031c @mattn fix Makefile: quoted CC/LL are heap up to each Makefiles.
mattn authored
18 LL = gcc
e0d6430 @mimaki add mruby sources
mimaki authored
19 DEBUG_MODE = 1
20 ifeq ($(DEBUG_MODE),1)
21 CFLAGS = -g
22 else
23 CFLAGS = -O3
24 endif
25 INCLUDES = -I../src -I../include
26 ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS)
db99923 @matz build process restructured
matz authored
27 ifeq ($(OS),Windows_NT)
28 MAKE_FLAGS = CC=$(CC) LL=$(LL) ALL_CFLAGS="$(ALL_CFLAGS)"
29 else
30 MAKE_FLAGS = CC='$(CC)' LL='$(LL)' ALL_CFLAGS='$(ALL_CFLAGS)'
31 endif
e0d6430 @mimaki add mruby sources
mimaki authored
32
33 # mruby compiler
34 ifeq ($(OS),Windows_NT)
35 MRBC = ../bin/mrbc.exe
36 else
37 MRBC = ../bin/mrbc
38 endif
39
40 ##############################
41 # generic build targets, rules
42
43 .PHONY : all
44 all : $(MRBC) $(MLIB)
45 @echo "make: built targets of `pwd`"
46
47 # Compile mrblib source
48 $(MLIB) : $(CLIB)
49 $(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $(CLIB) -o $(MLIB)
50
51 # Compile C source from merged mruby source
52 $(CLIB) : $(RLIB) $(MRBC)
53 $(MRBC) -Bmrblib_irep -o$(DLIB) $(RLIB); cat init_$(TARGET).c $(DLIB) > $@
54
55 $(MRBC) : ../src/opcode.h ../src/codegen.c ../src/parse.y
56 $(MAKE) -C ../tools/mrbc $(MAKE_FLAGS)
57
58 # merge mruby sources
59 $(RLIB) : $(MRBS)
60 cat $? > $@
61
62 # clean up
63 .PHONY : clean
64 clean :
65 @echo "make: removing targets, objects and depend files of `pwd`"
761ed34 @bovi Add dependency file to 'clean' target
bovi authored
66 -rm -f $(MRBC) $(MLIB) $(CLIB) $(RLIB) $(DLIB) $(DEPLIB)
e0d6430 @mimaki add mruby sources
mimaki authored
67
Something went wrong with that request. Please try again.