| 
									
										
										
										
											2014-10-14 23:16:11 -07:00
										 |  |  | # change notes:
 | 
					
						
							| 
									
										
										
										
											2014-10-14 23:21:03 -07:00
										 |  |  | # 	filter out -Werror when compiling ptest. GCC chooses to warn about strange things sometimes.
 | 
					
						
							|  |  |  | # 	mpc.c and mpc.h ompile will all flags below on clang and gcc with -Werror.
 | 
					
						
							| 
									
										
										
										
											2014-10-15 16:23:59 -07:00
										 |  |  | # 	added standard flag (and reverted to -ansi, can now be changed from command line `make -STD=...` 
 | 
					
						
							|  |  |  | # 	to compile against various standards.
 | 
					
						
							| 
									
										
										
										
											2014-10-14 23:16:11 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-09-19 20:57:40 +01:00
										 |  |  | CC = gcc | 
					
						
							| 
									
										
										
										
											2014-10-15 16:23:59 -07:00
										 |  |  | STND=-ansi | 
					
						
							|  |  |  | CFLAGS = $(STND) -pedantic -O3 -g -Werror -Wall -Wextra -Wformat=2 -Wshadow -Wno-long-long \
 | 
					
						
							|  |  |  | 		 -Wno-overlength-strings -Wno-format-nonliteral -Wcast-align \
 | 
					
						
							|  |  |  | 		 -Wwrite-strings -Wstrict-prototypes -Wold-style-definition -Wredundant-decls -Wnested-externs \
 | 
					
						
							|  |  |  | 		 -Wmissing-include-dirs -Wswitch-default | 
					
						
							| 
									
										
										
										
											2014-10-14 23:16:11 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-09-19 20:57:40 +01:00
										 |  |  | TESTS = $(wildcard tests/*.c) | 
					
						
							| 
									
										
										
										
											2014-01-26 11:25:50 +00:00
										 |  |  | EXAMPLES = $(wildcard examples/*.c) | 
					
						
							|  |  |  | EXAMPLESEXE = $(EXAMPLES:.c=) | 
					
						
							| 
									
										
										
										
											2013-09-19 20:57:40 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-01-26 11:25:50 +00:00
										 |  |  | all: $(EXAMPLESEXE) check  | 
					
						
							| 
									
										
										
										
											2014-10-14 22:33:21 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-09-19 20:57:40 +01:00
										 |  |  | check: $(TESTS) mpc.c | 
					
						
							| 
									
										
										
										
											2014-10-14 22:33:21 -07:00
										 |  |  | 	$(CC) $(filter-out -Werror, $(CFLAGS)) $^ -lm -o test | 
					
						
							| 
									
										
										
										
											2013-09-19 20:57:40 +01:00
										 |  |  | 	./test | 
					
						
							| 
									
										
										
										
											2014-10-14 22:33:21 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-01-26 11:25:50 +00:00
										 |  |  | examples/%: examples/%.c mpc.c | 
					
						
							|  |  |  | 	$(CC) $(CFLAGS) $^ -lm -o $@ | 
					
						
							|  |  |  |    | 
					
						
							| 
									
										
										
										
											2013-09-19 20:57:40 +01:00
										 |  |  | clean: | 
					
						
							| 
									
										
										
										
											2014-10-14 22:33:21 -07:00
										 |  |  | 	rm -rf test examples/doge examples/lispy examples/maths examples/smallc |