summaryrefslogtreecommitdiff
path: root/ext/dl/depend
blob: 50ef5cebbf12c5f43b551ab0563f373db4e7709e (plain)
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
RUBY = $(RUBY_INSTALL_NAME)$(EXEEXT)
CLEANFILES = test/test.o
DISTCLEANFILES = call.func callback.func cbtable.func dlconfig.rb dlconfig.h \
                 test/libtest.so test/*~ *~ mkmf.log

libtest.so: test/libtest.so

test/libtest.so: test/test.o test/libtest.def
	$(RUBY) -rftools -e 'ARGV.each{|d|File.mkpath(File.dirname(d))}' $@
	`$(RUBY) -e 'print ARGV.join(" ").gsub(/dl\\.def/,"test/libtest.def")' $(LDSHARED)` $(LDFLAGS) test/test.o -o test/libtest.so

test/test.o: test/test.c
	@$(RUBY) -rftools -e 'File.mkpath(*ARGV)' test
	$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@

test:: dl.so libtest.so .force
	$(RUBY) -I. -I$(srcdir)/lib $(srcdir)/test/test.rb

.force:

.PHONY: .force test

allclean: distclean
	@rm -f $(CLEANFILES) $(DISTCLEANFILES)

$(OBJS): dlconfig.h

sym.o: call.func

dl.o: callback.func cbtable.func

call.func: mkcall.rb dlconfig.rb
	@echo "Generating call.func"
	@$(RUBY) $< > $@

callback.func: mkcallback.rb dlconfig.rb
	@echo "Generating callback.func"
	@$(RUBY) $< > $@

cbtable.func: mkcbtable.rb dlconfig.rb
	@echo "Generating cbtable.func"
	@$(RUBY) $< > $@

debug:
	$(MAKE) CFLAGS+=-DDEBUG