-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (57 loc) · 1.81 KB
/
Copy pathMakefile
File metadata and controls
65 lines (57 loc) · 1.81 KB
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
SUBDIRS="lib src"
# try and optimize build on SMP machines
PARALLEL_MAKE+=$(shell if [ X$(OSTYPE) = XFreeBSD ] ; then echo -j `sysctl -n hw.ncpu` ; fi)
PARALLEL_MAKE+=$(shell if [ X$(OSTYPE) = Xlinux ] ; then echo -j `grep -c '^processor' /proc/cpuinfo` ; fi)
PARALLEL_MAKE+=$(shell if [ `uname` = Linux ] ; then echo -j `grep -c '^processor' /proc/cpuinfo` ; fi)
OPTFLAG?=-O4
# redhat gcc version 4.1.2 20070626 doesn't support this flag.
# if important, figure out the right way to detect support for this flag:
# OPTFLAG+=$(shell if [ `uname` = Linux ] ; then echo '-march=native' ; fi)
VERSION=0.1.4
RELEASE_FILE=statGen.$(VERSION).tgz
.PHONY: all test clean release
#
# see http://www.gnu.org/software/make/manual/make.html#Phony-Targets
# for a way of improving the following:
#
all test:
@for i in "$(SUBDIRS)"; do \
if [ "XXX$$i" = XXX ] ;\
then \
continue; \
fi;\
if [ \! -d $$i ] ; \
then \
echo "directory $$i does not exist, skipping." ; \
continue ; \
fi ; \
(echo "building in directory $$i";cd $$i; $(MAKE) $(PARALLEL_MAKE) OPTFLAG="$(OPTFLAG)" --no-print-directory $@) ; \
if [ $$? -ne 0 ] ; \
then \
echo "make stopped because of errors." ; \
break ; \
fi \
done
release:
(make clean)
# the touch gets rid of a tar warning
touch $(RELEASE_FILE)
tar cvz --exclude="*~" --exclude=$(RELEASE_FILE) --exclude=mach --exclude-vcs -f $(RELEASE_FILE) ../statgen
clean:
@for i in "$(SUBDIRS)"; do \
if [ "XXX$$i" = XXX ] ;\
then \
continue; \
fi;\
if [ \! -d $$i ] ; \
then \
echo "directory $$i does not exist, skipping." ; \
continue ; \
fi ; \
(echo "building in directory $$i";cd $$i; $(MAKE) $(PARALLEL_MAKE) --no-print-directory $@) ; \
if [ $$? -ne 0 ] ; \
then \
echo "make stopped because of errors." ; \
break ; \
fi \
done