myshellin/Makefile

66 lines
1.3 KiB
Makefile
Raw Normal View History

2021-06-19 17:54:33 -04:00
CC=clang
2021-07-26 01:20:57 -04:00
CFLAGS=-Wall -Isrc/include -g -std=c11
2021-06-19 19:13:53 -04:00
LDFLAGS=
FILENAME=myshellin
2021-07-20 19:24:22 -04:00
SRC=src/myshellin.c src/loop.c src/console_line.c src/array.c src/builtins.c src/launch.c src/utils.c src/redirect.c
2021-06-19 17:54:33 -04:00
OBJ=$(SRC:.c=.o)
2021-07-26 02:47:25 -04:00
all: shell doc report
2021-06-19 17:54:33 -04:00
2021-07-28 01:01:19 -04:00
shell:
ifneq (, $(shell which bear))
ifeq (, $(wildcard ./compile_commands.json))
$(MAKE) shellbear
else
$(MAKE) shellbuild
endif
else
$(MAKE) shellbuild
endif
shellbear:
bear make shellbuild
shellbuild: $(OBJ)
2021-06-19 19:13:53 -04:00
$(CC) $(CFLAGS) -o $(FILENAME) $^ $(LDFLAGS)
2021-06-19 17:54:33 -04:00
2021-07-26 02:47:25 -04:00
doc:
2021-07-28 01:01:19 -04:00
# if doxygen and bear are installed create the code documentation
ifneq (, $(shell which bear))
ifeq (, $(wildcard ./compile_commands.json))
$(MAKE) cleanshell
$(MAKE) shellbear
endif
2021-07-26 02:47:25 -04:00
ifneq (, $(shell which doxygen))
doxygen doxygen.conf
make -C docs/latex
mv docs/latex/refman.pdf refman.pdf
endif
2021-07-28 01:01:19 -04:00
endif
2021-07-26 02:47:25 -04:00
2021-07-23 11:56:15 -04:00
report:
# if pdflatex is installed create the report
2021-06-19 17:54:33 -04:00
ifneq (, $(shell which pdflatex))
2021-07-26 02:47:25 -04:00
make -C report
mv report/Informe.pdf Informe.pdf
else ifneq (, $(shell which pdftex))
2021-07-26 02:47:25 -04:00
make -C report
mv report/Informe.pdf Informe.pdf
2021-06-19 17:54:33 -04:00
endif
2021-07-26 02:47:25 -04:00
clean: cleanshell cleandoc cleanreport
2021-06-19 17:54:33 -04:00
2021-07-23 11:56:15 -04:00
cleanshell:
2021-07-28 01:01:19 -04:00
rm -f src/*.o $(FILENAME) compile_commands.json
2021-06-19 17:54:33 -04:00
2021-07-26 02:47:25 -04:00
cleandoc:
2021-07-28 01:01:19 -04:00
rm -rf refman.pdf docs compile_commands.json
2021-07-26 02:47:25 -04:00
2021-07-23 11:56:15 -04:00
cleanreport:
2021-07-26 02:47:25 -04:00
make -C report clean
2021-06-19 17:54:33 -04:00
rm -f Informe.pdf
2021-07-28 01:01:19 -04:00
.PHONY: all shell shellbear shellbuild doc report clean cleanshell cleandoc cleanreport