sd generator
This commit is contained in:
20
docker/Dockerfile
Normal file
20
docker/Dockerfile
Normal file
@@ -0,0 +1,20 @@
|
||||
FROM gcc:latest
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./generate.sh /app/
|
||||
RUN chmod 755 /app/generate.sh
|
||||
|
||||
COPY ./start.sh /app/
|
||||
RUN chmod 755 /app/start.sh
|
||||
|
||||
COPY ./Makefile /app/
|
||||
|
||||
ENTRYPOINT ["tail"]
|
||||
CMD ["-f","/dev/null"]
|
||||
|
||||
#CMD ["./generate.sh"]
|
||||
|
||||
|
||||
|
||||
|
||||
100
docker/Makefile
Normal file
100
docker/Makefile
Normal file
@@ -0,0 +1,100 @@
|
||||
#
|
||||
# 'make' build executable file 'main'
|
||||
# 'make clean' removes all .o and executable files
|
||||
#
|
||||
|
||||
# define the Cpp compiler to use
|
||||
CXX = g++
|
||||
|
||||
# define any compile-time flags
|
||||
# CXXFLAGS := -std=c++17 -Wall -Wextra -g -lssl -lcrypto
|
||||
CXXFLAGS := -Wall -Wextra -g -lssl -lcrypto -w
|
||||
|
||||
# define library paths in addition to /usr/lib
|
||||
# if I wanted to include libraries not in /usr/lib I'd specify
|
||||
# their path using -Lpath, something like:
|
||||
LFLAGS =
|
||||
|
||||
# define output directory
|
||||
OUTPUT := output
|
||||
|
||||
# define source directory
|
||||
SRC := src
|
||||
|
||||
# define include directory
|
||||
INCLUDE := include
|
||||
|
||||
# define lib directory
|
||||
LIB := lib
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
MAIN := licenceGenerator.exe
|
||||
SOURCEDIRS := $(SRC)
|
||||
INCLUDEDIRS := $(INCLUDE)
|
||||
LIBDIRS := $(LIB)
|
||||
FIXPATH = $(subst /,\,$1)
|
||||
RM := del /q /f
|
||||
MD := mkdir
|
||||
else
|
||||
MAIN := licenceGenerator
|
||||
SOURCEDIRS := $(shell find $(SRC) -type d)
|
||||
INCLUDEDIRS := $(shell find $(INCLUDE) -type d)
|
||||
LIBDIRS := $(shell find $(LIB) -type d)
|
||||
FIXPATH = $1
|
||||
RM = rm -f
|
||||
MD := mkdir -p
|
||||
endif
|
||||
|
||||
# define any directories containing header files other than /usr/include
|
||||
INCLUDES := $(patsubst %,-I%, $(INCLUDEDIRS:%/=%))
|
||||
|
||||
# define the C libs
|
||||
LIBS := $(patsubst %,-L%, $(LIBDIRS:%/=%))
|
||||
|
||||
# define the C source files
|
||||
SOURCES := $(wildcard $(patsubst %,%/*.cpp, $(SOURCEDIRS)))
|
||||
|
||||
# define the C object files
|
||||
OBJECTS := $(SOURCES:.cpp=.o)
|
||||
|
||||
# define the dependency output files
|
||||
DEPS := $(OBJECTS:.o=.d)
|
||||
|
||||
#
|
||||
# The following part of the makefile is generic; it can be used to
|
||||
# build any executable just by changing the definitions above and by
|
||||
# deleting dependencies appended to the file from 'make depend'
|
||||
#
|
||||
|
||||
OUTPUTMAIN := $(call FIXPATH,$(OUTPUT)/$(MAIN))
|
||||
|
||||
all: $(OUTPUT) $(MAIN)
|
||||
@echo Executing 'all' complete!
|
||||
|
||||
$(OUTPUT):
|
||||
$(MD) $(OUTPUT)
|
||||
|
||||
$(MAIN): $(OBJECTS)
|
||||
$(CXX) $(CXXFLAGS) $(INCLUDES) -o $(OUTPUTMAIN) $(OBJECTS) $(LFLAGS) $(LIBS)
|
||||
|
||||
# include all .d files
|
||||
-include $(DEPS)
|
||||
|
||||
# this is a suffix replacement rule for building .o's and .d's from .c's
|
||||
# it uses automatic variables $<: the name of the prerequisite of
|
||||
# the rule(a .c file) and $@: the name of the target of the rule (a .o file)
|
||||
# -MMD generates dependency output files same name as the .o file
|
||||
# (see the gnu make manual section about automatic variables)
|
||||
.cpp.o:
|
||||
$(CXX) $(CXXFLAGS) $(INCLUDES) -c -MMD $< -o $@
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
$(RM) $(OUTPUTMAIN)
|
||||
$(RM) $(call FIXPATH,$(OBJECTS))
|
||||
$(RM) $(call FIXPATH,$(DEPS))
|
||||
@echo Cleanup complete!
|
||||
|
||||
run: all
|
||||
./$(OUTPUTMAIN)
|
||||
@echo Executing 'run: all' complete!
|
||||
5
docker/generate.sh
Normal file
5
docker/generate.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
rm src/CreateLicence.o
|
||||
rm src/PlcLicence.o
|
||||
rm src/utils.o
|
||||
make
|
||||
7
docker/start.sh
Normal file
7
docker/start.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
chmod 777 output/licenceGenerator
|
||||
|
||||
#./output/licenceGenerator -cid=9f544930303030300000000b47015423 -csd=400e00325b5900003a0d7f800a40008d -outputType=file -configFileName=licData.xml
|
||||
|
||||
cd output
|
||||
./licenceGenerator -cid=9f544930303030300000000b47015423 -csd=400e00325b5900003a0d7f800a40008d -outputType=file -configFileName=licData.xml
|
||||
Reference in New Issue
Block a user