Makefile 813 B

1234567891011121314151617181920212223242526272829303132333435
  1. DIR_BUILD := build
  2. DIR_SRC := src
  3. NAME_PORJECT := PasswordGeneration
  4. NAME_HEDER := ArgsParser Testing_ArgsParser
  5. NAME_SOURCES := $(NAME_PORJECT) $(NAME_HEDER)
  6. FILES := $(addprefix $(DIR_SRC)/,$(NAME_SOURCES:=.c)) $(addprefix $(DIR_SRC)/,$(NAME_HEDER:=.h))
  7. CFLAGS := -g3 -O0 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wconversion
  8. RUN_ARGS := Hello World Hello
  9. all: build
  10. run:
  11. ./${DIR_BUILD}/${NAME_PORJECT} ${RUN_ARGS}
  12. ${DIR_BUILD}/${NAME_PORJECT}:
  13. gcc ${CFLAGS} -o $@ $(FILES)
  14. build: check ${DIR_BUILD}/${NAME_PORJECT}
  15. clear:
  16. if [ -f "$(DIR_BUILD)/${NAME_PORJECT}" ]; then\
  17. rm ${DIR_BUILD}/${NAME_PORJECT};\
  18. fi
  19. check:
  20. if [ -d "$(DIR_BUILD)" ]; then\
  21. echo "DIR: $(DIR_BUILD) ok";\
  22. else\
  23. mkdir $(DIR_BUILD);\
  24. echo "DIR: $(DIR_BUILD) created";\
  25. fi
  26. .PHONY: all build clear check