tests: PNG: Add RGBA8888 save test.
[gfxprim/pasky.git] / post.mk
blobdbc6d13692ccb46b5fba5c4fc9922c45df69fb79
2 # Make no subdirs by default
4 ifndef SUBDIRS
5 SUBDIRS=
6 endif
8 .PHONY: $(SUBDIRS) all clean rebuild help doc install
10 all: $(SUBDIRS)
11 clean: $(SUBDIRS)
12 distclean: $(SUBDIRS)
13 rebuild: $(SUBDIRS)
14 install: $(SUBDIRS)
16 help:
17 @echo "*** Available targets ***"
18 @echo ""
19 @echo "help: prints this help"
20 @echo ""
21 @echo "doc: builds (only) the documentation"
22 @echo ""
23 @echo "clean: cleans current directory and all subdirectories"
24 @echo ""
25 @echo "distclean: cleans all generated files including possible"
26 @echo " leftovers caused by deleted files"
27 @echo ""
28 @echo "all: make current directory and all subdirectories"
29 @echo ""
30 @echo "rebuild: does clean and all"
31 @echo ""
32 @echo "check: do pre-commit check"
33 @echo " (currently checks for exported symbols)"
34 @echo ""
35 @echo "The default silent output could be turned off by defining"
36 @echo "'VERBOSE' shell variable as 'VERBOSE=1 make'"
37 @echo ""
39 doc:
40 @cd $(TOPDIR)/doc && make
42 check:
43 @cd $(TOPDIR)/build && ./check_symbols.sh
46 # Determine mode (eg do not generate anything if not in compile mode
48 COMPILE=no
50 ifeq ($(MAKECMDGOALS),all)
51 COMPILE=yes
52 endif
54 ifeq ($(MAKECMDGOALS),)
55 COMPILE=yes
56 endif
58 ifeq ($(MAKECMDGOALS),rebuild)
59 COMPILE=yes
60 endif
63 # 1. Generate and include dependencies for all C sources
64 # 2. Generate OBJECTS list from CSOURCES list
65 # 3. Adds OBJECTS to CLEAN list
67 ifdef CSOURCES
68 DEPFILES=$(subst .c,.dep,$(CSOURCES))
69 ifeq ($(COMPILE),yes)
70 -include $(DEPFILES)
71 endif
72 CLEAN+=$(subst .c,.dep,$(CSOURCES))
73 OBJECTS+=$(CSOURCES:.c=.o)
74 CLEAN+=$(OBJECTS)
75 endif
78 # Automatically include library headers
80 ifdef LIBNAME
81 INCLUDE+=$(LIBNAME)
82 endif
85 # If there was anything in INCLUDE list, create CFLAGS for each entry
87 ifdef INCLUDE
88 CFLAGS+=$(addprefix -I$(TOPDIR)/include/, $(INCLUDE))
89 endif
92 # Walk trought SUBDIRS, this code works even for -jX
94 $(SUBDIRS):
95 ifdef VERBOSE
96 $(MAKE) -C $@ $(MAKECMDGOALS) TOP_MAKE=$(TOP_MAKE)
97 else
98 @export CURSUBDIR="$$CURSUBDIR/$@" && echo "DIR $$CURSUBDIR" &&\
99 $(MAKE) --no-print-directory -C $@ $(MAKECMDGOALS) TOP_MAKE=$(TOP_MAKE)
100 endif
103 # Actual make rules
105 $(DEPFILES): %.dep: %.c
106 ifdef VERBOSE
107 $(CC) -MM $(CFLAGS) $< -o $@
108 else
109 @echo "DEP -I(include $(INCLUDE)) $@"
110 @$(CC) -MM $(CFLAGS) $< -o $@
111 endif
113 $(OBJECTS): %.o: %.c
114 ifdef VERBOSE
115 $(CC) $(CFLAGS) -c $< -o $@
116 else
117 @echo "CC -I(include $(INCLUDE)) $@"
118 @$(CC) $(CFLAGS) -c $< -o $@
119 endif
121 ifdef CLEAN
123 ifeq ($(MAKECMDGOALS),distclean)
124 CLEAN+=*.o *.dep *.gen.c *.gen.h
125 endif
127 distclean: clean
129 clean:
130 ifdef VERBOSE
131 rm -f $(CLEAN)
132 else
133 @echo "RM $(CLEAN)"
134 @rm -f $(CLEAN)
135 endif
136 endif
138 compile: $(DEPFILES) $(OBJECTS) $(ALL)
140 rebuild: clean
141 @$(MAKE) --no-print-directory all