Skip to content
Newer
Older
100644 76 lines (62 sloc) 1.69 KB
c8c0ef8 @bovi mrit - Embeddable Ruby ISO Test
bovi authored
1 # makefile discription.
2 # basic build file for mruby library (Ruby part)
3
4 # project-specific macros
5 # extension of the executable-file is modifiable(.exe .out ...)
6 BASEDIR = .
8085817 @matz make test restructuring
matz authored
7 TARGET := mrbtest
8 LIBR := ../lib/libmruby.a
c8c0ef8 @bovi mrit - Embeddable Ruby ISO Test
bovi authored
9 MLIB := $(TARGET).o
10 CLIB := $(TARGET).c
8085817 @matz make test restructuring
matz authored
11 INIT := init_$(TARGET).c
c8c0ef8 @bovi mrit - Embeddable Ruby ISO Test
bovi authored
12 DLIB := $(TARGET).ctmp
13 RLIB := $(TARGET).rbtmp
8085817 @matz make test restructuring
matz authored
14 DEPLIB := $(TARGET).d driver.d
26c6031 @bovi Move assert lib for tests one directory up and add it always in the b…
bovi authored
15 ASSLIB := $(BASEDIR)/assert.rb
8085817 @matz make test restructuring
matz authored
16 MRBS := $(BASEDIR)/t/*.rb
17 OBJS := driver.o $(MLIB)
c8c0ef8 @bovi mrit - Embeddable Ruby ISO Test
bovi authored
18
105c11b @jonforums Clean and DRY up the basic Makefiles
jonforums authored
19 # libraries, includes
20 LIBS = -lm
21 INCLUDES = -I$(BASEDIR)/../src -I$(BASEDIR)/../include
22
c8c0ef8 @bovi mrit - Embeddable Ruby ISO Test
bovi authored
23 DEBUG_MODE = 1
24 ifeq ($(DEBUG_MODE),1)
25 CFLAGS = -g
26 else
27 CFLAGS = -O3
28 endif
29 ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS)
30 ifeq ($(OS),Windows_NT)
31 MAKE_FLAGS = CC=$(CC) LL=$(LL) ALL_CFLAGS="$(ALL_CFLAGS)"
32 else
33 MAKE_FLAGS = CC='$(CC)' LL='$(LL)' ALL_CFLAGS='$(ALL_CFLAGS)'
34 endif
35
8085817 @matz make test restructuring
matz authored
36 # mruby compiler and test driver
c8c0ef8 @bovi mrit - Embeddable Ruby ISO Test
bovi authored
37 ifeq ($(OS),Windows_NT)
38 MRBC = ../bin/mrbc.exe
8085817 @matz make test restructuring
matz authored
39 EXE := $(TARGET).exe
c8c0ef8 @bovi mrit - Embeddable Ruby ISO Test
bovi authored
40 else
41 MRBC = ../bin/mrbc
8085817 @matz make test restructuring
matz authored
42 EXE := $(TARGET)
43 endif
44
c8c0ef8 @bovi mrit - Embeddable Ruby ISO Test
bovi authored
45
46 ##############################
47 # generic build targets, rules
48
8085817 @matz make test restructuring
matz authored
49 .PHONY : test
332565e @matz remove confusing dependency; run "make" before "make test"
matz authored
50 all : $(EXE)
8085817 @matz make test restructuring
matz authored
51 ./$(EXE)
52
53 # executable constructed using linker from object files
332565e @matz remove confusing dependency; run "make" before "make test"
matz authored
54 $(EXE) : $(OBJS)
8085817 @matz make test restructuring
matz authored
55 $(LL) -o $@ $(CFLAGS) $(OBJS) $(LIBR) $(LIBS)
56
57 -include $(OBJS:.o=.d)
58
59 # objects compiled from source
60 $(OBJS) : %.o : %.c
61 $(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $< -o $@
62
c8c0ef8 @bovi mrit - Embeddable Ruby ISO Test
bovi authored
63 # Compile C source from merged mruby source
8085817 @matz make test restructuring
matz authored
64 $(CLIB) : $(RLIB) $(MRBC) $(INIT)
105c11b @jonforums Clean and DRY up the basic Makefiles
jonforums authored
65 $(MRBC) -Bmrbtest_irep -o$(DLIB) $(RLIB); $(CAT) $(INIT) $(DLIB) > $@
c8c0ef8 @bovi mrit - Embeddable Ruby ISO Test
bovi authored
66
67 # merge mruby sources
26c6031 @bovi Move assert lib for tests one directory up and add it always in the b…
bovi authored
68 $(RLIB) : $(ASSLIB) $(MRBS)
105c11b @jonforums Clean and DRY up the basic Makefiles
jonforums authored
69 $(CAT) $(ASSLIB) $(MRBS) > $@
c8c0ef8 @bovi mrit - Embeddable Ruby ISO Test
bovi authored
70
71 # clean up
72 .PHONY : clean
73 clean :
74 @echo "make: removing targets, objects and depend files of `pwd`"
105c11b @jonforums Clean and DRY up the basic Makefiles
jonforums authored
75 -$(RM_F) $(MLIB) $(CLIB) $(RLIB) $(DLIB) $(DEPLIB) $(OBJS) $(EXE)
Something went wrong with that request. Please try again.