 d7962a54dc
			
		
	
	d7962a54dc
	
	
	
		
			
			a command can now return SHELLMATTA_BUSY This will be passed back to the caller of processData afterwards the instance has to be called with the same parameters The shellmatta will then just call the busy command until it finishes as soon as the command returns != SHELLMATTA_BUSY the instance will continue processing the rest of the input data
		
			
				
	
	
		
			157 lines
		
	
	
		
			6.1 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
			
		
		
	
	
			157 lines
		
	
	
		
			6.1 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
| # 
 | |
| # Copyright (c) 2019 Stefan Strobel <stefan.strobel@shimatta.net>
 | |
| # 
 | |
| # This Source Code Form is subject to the terms of the Mozilla Public
 | |
| # License, v. 2.0. If a copy of the MPL was not distributed with this
 | |
| # file, You can obtain one at https://mozilla.org/MPL/2.0/.
 | |
| # 
 | |
| 
 | |
| OBJ_DIR := output/
 | |
| 
 | |
| CC  := gcc
 | |
| CPP := g++
 | |
| LN  := ln
 | |
| 
 | |
| SOURCES :=  src/shellmatta.c                \
 | |
|             src/shellmatta_autocomplete.c   \
 | |
|             src/shellmatta_history.c        \
 | |
|             src/shellmatta_utils.c          \
 | |
|             src/shellmatta_escape.c         \
 | |
|             src/shellmatta_opt.c
 | |
| 
 | |
| INCLUDES    := api .
 | |
| 
 | |
| UNITTEST_SOURCES := test/unittest/test_main.cpp                                         \
 | |
|                     test/unittest/shellmatta_opt/test_opt_findNextHunk.cpp              \
 | |
|                     test/unittest/shellmatta_utils/test_utils_writeEcho.cpp             \
 | |
|                     test/unittest/shellmatta_utils/test_utils_shellItoa.cpp             \
 | |
|                     test/unittest/shellmatta_utils/test_utils_saveCursorPos.cpp         \
 | |
|                     test/unittest/shellmatta_utils/test_utils_restoreCursorPos.cpp      \
 | |
|                     test/unittest/shellmatta_utils/test_utils_eraseLine.cpp             \
 | |
|                     test/unittest/shellmatta_utils/test_utils_rewindCursor.cpp          \
 | |
|                     test/unittest/shellmatta_utils/test_utils_forwardCursor.cpp         \
 | |
|                     test/unittest/shellmatta_utils/test_utils_clearInput.cpp            \
 | |
|                     test/unittest/shellmatta_utils/test_utils_insertChars.cpp           \
 | |
|                     test/unittest/shellmatta_utils/test_utils_terminateInput.cpp        \
 | |
|                     test/unittest/shellmatta_autocomplete/test_autocomplete_run.cpp     \
 | |
|                     test/unittest/shellmatta_escape/test_escape_processArrowKeys.cpp    \
 | |
|                     test/unittest/shellmatta_history/test_appendHistoryByte.cpp         \
 | |
|                     test/unittest/shellmatta/test_shellmatta_doInit.cpp
 | |
| 
 | |
| INTEGRATIONTEST_SOURCES :=  test/integrationtest/test_main.cpp                  \
 | |
|                             test/integrationtest/test_integration.cpp           \
 | |
|                             test/integrationtest/test_integration_opt.cpp       \
 | |
|                             test/integrationtest/test_integration_optLong.cpp   \
 | |
|                             test/integrationtest/test_integration_busy.cpp
 | |
| 
 | |
| UNITTEST_CPPOBJ  := $(patsubst %.cpp,$(OBJ_DIR)%.o,$(UNITTEST_SOURCES))
 | |
| 
 | |
| INTEGRATIONTEST_CPPOBJ  := $(patsubst %.cpp,$(OBJ_DIR)%.o,$(INTEGRATIONTEST_SOURCES))
 | |
| 
 | |
| CFLAGS      := $(INCLUDES:%=-I%) -g -Wall -Werror -Wextra -pedantic -DSHELLMATTA_HELP_ALIAS=\"?\"
 | |
| TESTFLAGS   := $(INCLUDES:%=-I%) -g -Wall -Werror -Wextra -fprofile-arcs -ftest-coverage -pedantic
 | |
| TESTLFLAGS  := -fprofile-arcs -Wl,--allow-multiple-definition
 | |
| 
 | |
| DEPEND      = -MT $@ -MF "$(@:%.o=%.d)" -MG -MM
 | |
| 			
 | |
| COBJ    := $(patsubst %.c,$(OBJ_DIR)%.o,$(SOURCES))
 | |
| 
 | |
| EXAMPLE_SOURCES := example/main.c
 | |
| EXAMPLE_COBJ     := $(patsubst %.c,$(OBJ_DIR)%.o,$(EXAMPLE_SOURCES))
 | |
| 
 | |
| EXAMPLE_TARGET  := $(OBJ_DIR)example/example
 | |
| 
 | |
| UNITTEST_TARGET     := $(OBJ_DIR)test/unittest/unittest
 | |
| 
 | |
| INTEGRATIONTEST_TARGET     := $(OBJ_DIR)test/integrationtest/integrationtest
 | |
| 
 | |
| OBJ     := $(COBJ) $(EXAMPLE_COBJ) $(UNITTEST_CPPOBJ) $(INTEGRATIONTEST_CPPOBJ)
 | |
| DEPS    := $(OBJ:%.o=%.d)
 | |
| 
 | |
| export
 | |
| 
 | |
| help:
 | |
| 	@echo Shellmatta help
 | |
| 	@echo -------------------------
 | |
| 	@echo test      - run all tests
 | |
| 	@echo example   - build example
 | |
| 	@echo -------------------------
 | |
| 
 | |
| test: unittest integrationtest
 | |
| 
 | |
| cppcheck:
 | |
| 	- @mkdir -p output/cppcheck/html
 | |
| 	cppcheck --addon=/usr/bin/misra.py --enable=all --template=gcc --cppcheck-build-dir=output/cppcheck $(SOURCES)
 | |
| 	cppcheck --addon=/usr/bin/misra.py --enable=all --template=gcc --cppcheck-build-dir=output/cppcheck $(SOURCES) --xml 2>output/cppcheck/cppcheck.xml
 | |
| 	cppcheck-htmlreport --file=output/cppcheck/cppcheck.xml --title="Shellmatta" --report-dir=output/cppcheck/html
 | |
| 
 | |
| unittest: $(UNITTEST_TARGET)
 | |
| 	- @mkdir -p output/test/unittest/report
 | |
| 	@echo running test:
 | |
| 	@# remove coverage from former run
 | |
| 	@-find . -name "*.gcda" -type f -delete
 | |
| 	-$(UNITTEST_TARGET)
 | |
| 	@#gcov -o output/test/unittest $(UNITTEST_CPPOBJ) -r src
 | |
| 
 | |
| 	@# remove report from former run
 | |
| 	-rm -rf $(OBJ_DIR)test/unittest/report/*
 | |
| 	gcovr --html-details --output $(OBJ_DIR)test/unittest/report/report.html output/test/unittest -f src -f api
 | |
| 	@#-rm *.gcov
 | |
| 	
 | |
| integrationtest: $(INTEGRATIONTEST_TARGET)
 | |
| 	- @mkdir -p output/test/integrationtest/report
 | |
| 	@echo running test:
 | |
| 	-$(INTEGRATIONTEST_TARGET)
 | |
| 	#gcov -o output/test $(TEST_CPPOBJ) -r
 | |
| 	gcovr --html-details --output $(OBJ_DIR)test/integrationtest/report/report.html output/src -f src -f api
 | |
| 	#-rm *.gcov
 | |
| 	
 | |
| example: $(EXAMPLE_TARGET)
 | |
| 	@echo building example
 | |
| 
 | |
| doc:
 | |
| 	- @mkdir -p output/doc/html
 | |
| 	- @mkdir -p output/doc/latex
 | |
| 	doxygen cfg/doxygen/doxyfile
 | |
| 	
 | |
| clean:
 | |
| 	- rm -rf $(OBJ_DIR)
 | |
| 
 | |
| $(EXAMPLE_TARGET): $(COBJ) $(EXAMPLE_COBJ)
 | |
| 	- @mkdir -p $(@D)
 | |
| 	$(CC) $(LFLAGS) $(LIB_PATH) -o $@ $^ $(LIBS)
 | |
| 
 | |
| $(UNITTEST_TARGET): $(UNITTEST_CPPOBJ)
 | |
| 	- @mkdir -p $(@D)
 | |
| 	$(CPP) $(TESTLFLAGS) $(LIB_PATH) -o $@ $^ $(LIBS)
 | |
| 	
 | |
| $(INTEGRATIONTEST_TARGET): $(INTEGRATIONTEST_CPPOBJ) $(COBJ)
 | |
| 	- @mkdir -p $(@D)
 | |
| 	$(CPP) $(TESTLFLAGS) $(LIB_PATH) -o $@ $^ $(LIBS)
 | |
| 
 | |
| $(TARGET): $(OBJ)
 | |
| 	- @mkdir -p $(@D)
 | |
| 	$(CC) $(LFLAGS) $(LIB_PATH) -o $@ $^ $(LIBS)
 | |
| 	
 | |
| $(COBJ):
 | |
| 	- @mkdir -p $(@D)
 | |
| 	@$(CC) -c $(CFLAGS)  $(DEPEND) -o $@  $(subst $(OBJ_DIR), ,$(@:%.o=%.c))
 | |
| 	$(CC) -c $(CFLAGS) -o $@  $(subst $(OBJ_DIR), ,$(@:%.o=%.c))
 | |
| 
 | |
| $(EXAMPLE_COBJ):
 | |
| 	- @mkdir -p $(@D)
 | |
| 	@$(CC) -c $(CFLAGS) $(DEPEND) -o $@  $(subst $(OBJ_DIR), ,$(@:%.o=%.c))
 | |
| 	$(CC) -c $(CFLAGS) -o $@  $(subst $(OBJ_DIR), ,$(@:%.o=%.c))
 | |
| 
 | |
| $(UNITTEST_CPPOBJ) $(INTEGRATIONTEST_CPPOBJ):
 | |
| 	- @mkdir -p $(@D)
 | |
| 	@$(CPP) -c $(TESTFLAGS) $(DEPEND) -o $@  $(subst $(OBJ_DIR), ,$(@:%.o=%.cpp))
 | |
| 	$(CPP) -c $(TESTFLAGS) -o $@  $(subst $(OBJ_DIR), ,$(@:%.o=%.cpp))
 | |
| 
 | |
| %.o: %.cpp
 | |
| 	- @mkdir -p $(@D)
 | |
| 	@$(CPP) -c $(CFLAGS) $(DEPEND) -o $@  $(subst $(OBJ_DIR), ,$(@:%.o=%.c))
 | |
| 	$(CPP) -c $(CFLAGS) -o $@  $<
 | |
| 
 | |
| -include $(DEPS)
 |