File: commands

package info (click to toggle)
xacobeo 0.13-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,804 kB
  • ctags: 745
  • sloc: xml: 33,885; perl: 2,353; ansic: 1,128; makefile: 127
file content (180 lines) | stat: -rwxr-xr-x 3,422 bytes parent folder | download | duplicates (4)
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#!/usr/bin/make -f

# Local installation place
DEST=target

# Default test file
FILE=tests/sample.xml

VERSION=$(shell perl -le "print `grep VERSION lib/Xacobeo.pm`")
PACKAGE=Xacobeo
EMAIL=$(shell git config --global user.email)

PERL_MODULES=$(shell find lib/Xacobeo/ -type f -name '*.pm')

# Compiler stuff
LIBRARIES=gtk+-2.0 libxml-2.0

ifdef DEBUG
	DEBUG_ARGS=-DHAS_DEBUG
else
	DEBUG_ARGS=-D__EMPTY
endif


CFLAGS=$(shell pkg-config --cflags $(LIBRARIES); perl -MExtUtils::Embed -e ccopts)
LIBS=$(shell pkg-config --libs $(LIBRARIES) ; perl -MExtUtils::Embed -e ldopts)
CC=gcc $(DEBUG_ARGS) -g -std=c99 -Werror -Wall -Wextra -pedantic-errors -pedantic \
 -Wshadow \
 -Wunused-parameter \
 -Wmissing-field-initializers \
 -Wmissing-noreturn \
 -Wmissing-declarations \
 -Wmissing-prototypes \
 -Wmissing-format-attribute \
 -Wpointer-arith \
 -Wwrite-strings \
 -Wformat \
 -Wformat-nonliteral \
 -Wformat-security \
 -Wswitch-default \
 -Winit-self \
 -Wundef \
 -Waggregate-return \
 -Wnested-externs \
 -Wno-unused-function


.PHONY: info
info:
	@echo "VERSION $(VERSION)"
	@echo "CFLAGS  $(CFLAGS)"
	@echo "LIBS    $(LIBS)"
	@echo "CC      $(CC)"


perl-build: Build
Build: Build.PL
	perl Build.PL --config ccflags="$(DEBUG_ARGS)"


build: i18n Build
	./Build


.PHONY: install
install: $(DEST)/local/bin/xacobeo
$(DEST)/local/bin/xacobeo: build
	rm -rf $(DEST) || true
	./Build install --install_base $(DEST)


.PHONY: fakeinstall
fakeinstall: build
	./Build fakeinstall --install_base /usr 


.PHONY: run
run: install
	PERL5LIB=$(DEST)/lib/perl5 $(DEST)/bin/xacobeo $(FILE)


.PHONY: dist
dist: $(PACKAGE)-$(VERSION).tar.gz
$(PACKAGE)-$(VERSION).tar.gz: build
	./Build dist


.PHONY: distcheck
distcheck: build
	./Build distcheck


.PHONY: test
test: xs
	./Build test


.PHONY: tag
tag:
	git tag "$(VERSION)"


.PHONY: push
push:
	git push --tags origin master


.PHONY: upload
upload: dist
	cpan-upload -verbose -mailto "$(EMAIL)" -user potyl "$(PACKAGE)-$(VERSION).tar.gz"


.PHONY: release
release: clean test dist distcheck tag push upload
	@echo "Release $(PACKAGE) $(VERSION) done."
	

.PHONY: xs
xs: build commands


xs/main.o: xs/main.c
	$(CC) $(CFLAGS) -o $@ -c $<


xs/logger.o: xs/logger.c
	$(CC) $(CFLAGS) -o $@ -c $<


xs/code.o: xs/code.c
	$(CC) $(CFLAGS) -o $@ -c $<


xs/libxml.o: xs/libxml.c
	$(CC) $(CFLAGS) -Wno-unused-parameter -o $@ -c $<
	

main: xs/main.o xs/code.o xs/logger.o xs/libxml.o
	$(CC) $(LIBS) -o $@ xs/main.o xs/code.o xs/logger.o xs/libxml.o	


.PHONY: all
all: main xs


.PHONY: leaks
leaks: main
	valgrind --tool=memcheck --leak-check=full --show-reachable=yes --trace-children=yes --suppressions=.valgrind ./main --quit $(FILE)


.PHONY: clean
clean:
	- [ -f Build ] && ./Build clean  > /dev/null 2>&1 || true
	-rm -rf $(PACKAGE)-*/ 2> /dev/null || true
	-rm $(PACKAGE)-*.tar.gz 2> /dev/null || true
	-rm libxacobeo-perl_* 2> /dev/null || true
	-rm Build 2> /dev/null || true
	-rm -rf _build 2> /dev/null || true
	-rm -f main xs/*.o  || true
	-rm -f lib/Xacobeo/XS.xs lib/Xacobeo/XS.c lib/Xacobeo/libxml2-perl.typemap || true


.PHONY: i18n
i18n: po/messages.pot po/*.po


po/messages.pot:  bin/xacobeo $(PERL_MODULES)
	xgettext --language=Perl \
	  --keyword \
	  --keyword=__ \
	  --keyword=__x \
	  --keyword=__n:1,2 \
	  --keyword=__nx:1,2 \
	  --keyword=__xn \
	  --keyword=N__ \
	  -o $@ bin/xacobeo $(PERL_MODULES)


po/%.po: po/messages.pot
	msgmerge --update $@ $<