Added a dist target and dist/ subdirectory, for easing creation of uploadable distrib...
[xuni.git] / Makefile
blob1857ca9c3dbb7792e96ca62f5c049a765b4b099e
1 # Makefile for xuni, Linux version
3 TARGET = ./xuni
4 GDB = gdb
6 SRC = src
7 SRC_TARGETS = all depend clean wc
9 DOC = doc
11 # Default target: all
12 .PHONY: all
13 all:
15 # Project-wide targets
16 .PHONY: dist
17 dist:
18 -rm dist/*
19 svn list -R > FILES
20 ls doc/html/* >> FILES
21 echo xuni >> FILES
22 echo xuni.exe >> FILES
23 tar --no-recursion -cf dist/xuni.tar $(shell cat FILES)
24 gzip dist/xuni.tar
26 # Targets relating to executables
27 .PHONY: run runa debug profile
28 run: all
29 $(TARGET)
30 runa: all
31 $(TARGET) $(ARGS)
32 debug: all
33 $(GDB) $(TARGET)
34 profile:
35 $(MAKE) -C $(SRC) clean all \
36 '$(shell grep -E "CFLAGS\s?=" $(SRC)/Makefile) -pg'
37 $(TARGET)
38 tempfile --directory . --prefix prof- --suffix .out > profile.name
39 gprof $(TARGET) > $(shell cat profile.name)
40 cp $(TARGET) $(TARGET)_profile
41 $(MAKE) -C $(SRC) clean
42 cp $(TARGET)_profile $(TARGET)
43 cat profile.name
44 viewprofile:
45 gnome-terminal -x kprof -f $(shell cat profile.name)
47 # Targets from and relating to src/
48 .PHONY: $(SRC)
49 $(SRC_TARGETS):
50 $(MAKE) -C $(SRC) $@
52 # Targets from and relating to doc/
53 .PHONY: $(DOC)
54 $(DOC):
55 $(MAKE) -C $(DOC)
57 # Linux-only targets
58 .PHONY: memcheck permissions
59 memcheck: $(TARGET)
60 valgrind --leak-check=full -v ./$(TARGET) 2>&1\
61 | tee valgrind.output | less
62 permissions:
63 chmod 644 $(shell find -type f)
64 chmod 755 $(shell find -type d) $(TARGET) $(TARGET).exe