Created
March 7, 2010 15:27
-
-
Save pwl/324411 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# # | |
# Makefile # | |
# # | |
#finds all .c files and replaces the .c with .o | |
OBJECTS = $(patsubst %.c,%.o,$(wildcard *.c)) | |
#finds all directories in this folder | |
DIRS = $(patsubst %/,%,$(wildcard */)) | |
# default: $(OBJECTS) | |
.PHONY: clean $(DIRS) #$(OBJECTS) | |
project: $(DIRS) $(OBJECTS) | |
@ar rs $(ARCHIVE) $(OBJECTS) | |
@rm -f $(OBJECTS) | |
# compiles all the .c files into .o files | |
$(OBJECTS): %.o: %.c %.h | |
@echo "\033[1m$<\033[0m" | |
@$(CC) $(FLAGS) $(INCLUDES) -c -o $@ $< | |
# $(OBJECTS): %.o: %.c %.h | |
# echo "$(CC) $(FLAGS) $(INCLUDES) -c -o $@ $<" | |
# $(CC) $(FLAGS) $(INCLUDES) -c -o $@ $< | |
# OBJECTS are temporarly made .PHONY | |
# recursively make all subdirectories | |
$(DIRS): | |
@echo "\033[1;36m$(CURDIR)/$@\033[0m" | |
@$(MAKE) --no-print-directory -eC $@ project | |
clean: | |
@rm -f *.o *.a | |
@for d in $(DIRS); do $(MAKE) -eC "$${d}" $@; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# # | |
# Makefile # | |
# # | |
export SHELL = /bin/bash | |
export CC = cc | |
export WFLAGS = -ansi -pedantic -Wall \ | |
-Wshadow \ | |
-Wmissing-prototypes -Wstrict-prototypes \ | |
-Wpointer-arith -Wcast-qual -Wcast-align \ | |
-Wwrite-strings -Wnested-externs \ | |
-fshort-enums -fno-common -Dinline= | |
export CFLAGS = $(WFLAGS) | |
export OFLAGS = -O2 # left empty for debuggin reasons | |
export GDBFLAGS = -ggdb | |
export FLAGS = $(CFLAGS) $(OFLAGS) $(GDBFLAGS) | |
export LIBS = -lm -lgsl -lgslcblas # -lfftw3 | |
export ARCHIVE = $(PWD)/libyapdes.a | |
export MAKEFILES = $(PWD)/Makefile.common | |
DIRS = $(patsubst %/,%,$(wildcard */)) | |
export INCLUDES = $(patsubst %/, -I $(PWD)/%, $(wildcard */)) | |
.PHONY : clean $(DIRS) projekty | |
project: CLEAR_AR $(DIRS) | |
test: project test.o $(DIRS) | |
$(CC) $(FLAGS) $(LIBS) $(INCLUDES) test.o $(ARCHIVE) -o $@ | |
test.o: test.c test.h | |
$(CC) $(FLAGS) $(INCLUDES) -c -o $@ $< | |
CLEAR_AR: | |
@rm -f libyapdes.a | |
@ar rs libyapdes.a | |
$(DIRS): | |
@echo -e "\033[1;36m$(CURDIR)/$@\033[0m" | |
@$(MAKE) --no-print-directory -eC $@ project | |
clean: | |
@rm -f *.o libyapdes.a | |
@for d in $(DIRS); do $(MAKE) -eC "$${d}" $@; done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment