diff --git a/bash/delunpack/exclude_hand.lst.bkp b/bash/delunpack/exclude_hand.lst.bkp deleted file mode 100644 index 5384ce3..0000000 --- a/bash/delunpack/exclude_hand.lst.bkp +++ /dev/null @@ -1,21 +0,0 @@ ------ Базовая система ----- -linux-image-2.6.20.21 -sudo -gdm ----- Администрирование ---- -synaptic ------- Рабочий стол ------- -gnome-panel -gnome-terminal -nautilus -gnome-volume-manager ---- Средства разработки --- -gcc -make ------- Сборка ядра -------- -fakeroot -kernel-package -libncurses5-dev -libc6-dev ----------- Игры ----------- -nexuiz diff --git a/c/12309/Makefile b/c/12309/Makefile new file mode 100644 index 0000000..6876b5c --- /dev/null +++ b/c/12309/Makefile @@ -0,0 +1,100 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES= +TARGET0=test12309 +TARGET= $(TARGET0) +INCLUDE1=-I$(HOME)/projects/include +INCLUDE2=-I/usr/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + test12309.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +test12309.o: \ + test12309.c + diff --git a/c/5minLorTest/Makefile b/c/5minLorTest/Makefile new file mode 100644 index 0000000..ce76e5e --- /dev/null +++ b/c/5minLorTest/Makefile @@ -0,0 +1,111 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES= +TARGET0=5min +TARGET1=typical_errors_in_c +TARGET= $(TARGET0) $(TARGET1) +INCLUDE1=-I$(HOME)/projects/include +INCLUDE2=-I/usr/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + 5min.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +target_objs1 = \ + typical_errors_in_c.o + +$(TARGET1): $(target_objs1) + $(CC) $(LDFLAGS) -o $@ $(target_objs1) + + +5min.o: \ + 5min.c + +typical_errors_in_c.o: \ + typical_errors_in_c.c + diff --git a/c/LebedevRebusy/Makefile b/c/LebedevRebusy/Makefile new file mode 100644 index 0000000..c7dedc9 --- /dev/null +++ b/c/LebedevRebusy/Makefile @@ -0,0 +1,122 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES= +TARGET0=koka_kola_voda +TARGET1=koza_koza_stado +TARGET2=magnij_tantal_metally +TARGET= $(TARGET0) $(TARGET1) $(TARGET2) +INCLUDE1=-I$(HOME)/projects/include +INCLUDE2=-I/usr/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + koka_kola_voda.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +target_objs1 = \ + koza_koza_stado.o + +$(TARGET1): $(target_objs1) + $(CC) $(LDFLAGS) -o $@ $(target_objs1) + + +target_objs2 = \ + magnij_tantal_metally.o + +$(TARGET2): $(target_objs2) + $(CC) $(LDFLAGS) -o $@ $(target_objs2) + + +koka_kola_voda.o: \ + koka_kola_voda.c + +koza_koza_stado.o: \ + koza_koza_stado.c + +magnij_tantal_metally.o: \ + magnij_tantal_metally.c + diff --git a/c/ParallelsTest/Makefile b/c/ParallelsTest/Makefile new file mode 100644 index 0000000..36fa08d --- /dev/null +++ b/c/ParallelsTest/Makefile @@ -0,0 +1,166 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES= +TARGET0=1 +TARGET1=10 +TARGET2=4npipe +TARGET3=4unpipe +TARGET4=6 +TARGET5=77 +TARGET6=tmp +TARGET= $(TARGET0) $(TARGET1) $(TARGET2) $(TARGET3) $(TARGET4) $(TARGET5) $(TARGET6) +INCLUDE1=-I$(HOME)/projects/include +INCLUDE2=-I/usr/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + 1.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +target_objs1 = \ + 10.o + +$(TARGET1): $(target_objs1) + $(CC) $(LDFLAGS) -o $@ $(target_objs1) + + +target_objs2 = \ + 4npipe.o + +$(TARGET2): $(target_objs2) + $(CC) $(LDFLAGS) -o $@ $(target_objs2) + + +target_objs3 = \ + 4unpipe.o + +$(TARGET3): $(target_objs3) + $(CC) $(LDFLAGS) -o $@ $(target_objs3) + + +target_objs4 = \ + 6.o + +$(TARGET4): $(target_objs4) + $(CC) $(LDFLAGS) -o $@ $(target_objs4) + + +target_objs5 = \ + 77.o + +$(TARGET5): $(target_objs5) + $(CC) $(LDFLAGS) -o $@ $(target_objs5) + + +target_objs6 = \ + tmp.o + +$(TARGET6): $(target_objs6) + $(CC) $(LDFLAGS) -o $@ $(target_objs6) + + +1.o: \ + 1.c + +10.o: \ + 10.c + +4npipe.o: \ + 4npipe.c + +4unpipe.o: \ + 4unpipe.c + +6.o: \ + 6.c + +77.o: \ + 77.c + +tmp.o: \ + tmp.c + diff --git a/c/ParallelsTest/ParallelsTest/Makefile b/c/ParallelsTest/ParallelsTest/Makefile new file mode 100644 index 0000000..2b7501d --- /dev/null +++ b/c/ParallelsTest/ParallelsTest/Makefile @@ -0,0 +1,133 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES= +TARGET0=1 +TARGET1=10 +TARGET2=4npipe +TARGET3=4unpipe +TARGET= $(TARGET0) $(TARGET1) $(TARGET2) $(TARGET3) +INCLUDE1=-I$(HOME)/projects/include +INCLUDE2=-I/usr/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + 1.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +target_objs1 = \ + 10.o + +$(TARGET1): $(target_objs1) + $(CC) $(LDFLAGS) -o $@ $(target_objs1) + + +target_objs2 = \ + 4npipe.o + +$(TARGET2): $(target_objs2) + $(CC) $(LDFLAGS) -o $@ $(target_objs2) + + +target_objs3 = \ + 4unpipe.o + +$(TARGET3): $(target_objs3) + $(CC) $(LDFLAGS) -o $@ $(target_objs3) + + +1.o: \ + 1.c + +10.o: \ + 10.c + +4npipe.o: \ + 4npipe.c + +4unpipe.o: \ + 4unpipe.c + diff --git a/c/ToUpperTest/Makefile b/c/ToUpperTest/Makefile new file mode 100644 index 0000000..bb8ac44 --- /dev/null +++ b/c/ToUpperTest/Makefile @@ -0,0 +1,100 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES= +TARGET0=main +TARGET= $(TARGET0) +INCLUDE1=-I$(HOME)/projects/include +INCLUDE2=-I/usr/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + main.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +main.o: \ + main.c + diff --git a/c/ToUpperTest/build b/c/ToUpperTest/build deleted file mode 120000 index c07a74d..0000000 --- a/c/ToUpperTest/build +++ /dev/null @@ -1 +0,0 @@ -build.sh \ No newline at end of file diff --git a/c/ToUpperTest/build.sh b/c/ToUpperTest/build.sh deleted file mode 100755 index 13bb4bd..0000000 --- a/c/ToUpperTest/build.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -rm -f test test.o -gcc -static -o test main.c -#gcc -c -static test.o main.c && \ -#ld -static -o test test.o && \ -#rm test.o - -./test diff --git a/c/avg_task/Makefile b/c/avg_task/Makefile new file mode 100644 index 0000000..c20f848 --- /dev/null +++ b/c/avg_task/Makefile @@ -0,0 +1,111 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES= +TARGET0=avg +TARGET1=avg_arr +TARGET= $(TARGET0) $(TARGET1) +INCLUDE1=-I$(HOME)/projects/include +INCLUDE2=-I/usr/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + avg.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +target_objs1 = \ + avg_arr.o + +$(TARGET1): $(target_objs1) + $(CC) $(LDFLAGS) -o $@ $(target_objs1) + + +avg.o: \ + avg.c + +avg_arr.o: \ + avg_arr.c + diff --git a/c/bigmalloc/Makefile b/c/bigmalloc/Makefile new file mode 100644 index 0000000..db67908 --- /dev/null +++ b/c/bigmalloc/Makefile @@ -0,0 +1,111 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES=-lstdc++ +TARGET0=bigmalloc +TARGET1=bignew +TARGET= $(TARGET0) $(TARGET1) +INCLUDE1=-I$(HOME)/projects/include +INCLUDE2=-I/usr/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + bigmalloc.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +target_objs1 = \ + bignew.o + +$(TARGET1): $(target_objs1) + $(CC) $(LDFLAGS) -o $@ $(target_objs1) + + +bigmalloc.o: \ + bigmalloc.c + +bignew.o: \ + bignew.cpp + diff --git a/c/echo_server-udp/Makefile b/c/echo_server-udp/Makefile new file mode 100644 index 0000000..19e44af --- /dev/null +++ b/c/echo_server-udp/Makefile @@ -0,0 +1,155 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES= +TARGET0=echo-client +TARGET1=echo-server +TARGET2=int2ip +TARGET3=ip2int +TARGET4=sock1 +TARGET5=tmp1 +TARGET= $(TARGET0) $(TARGET1) $(TARGET2) $(TARGET3) $(TARGET4) $(TARGET5) +INCLUDE1=-I$(HOME)/projects/include +INCLUDE2=-I/usr/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + echo-client.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +target_objs1 = \ + echo-server.o + +$(TARGET1): $(target_objs1) + $(CC) $(LDFLAGS) -o $@ $(target_objs1) + + +target_objs2 = \ + int2ip.o + +$(TARGET2): $(target_objs2) + $(CC) $(LDFLAGS) -o $@ $(target_objs2) + + +target_objs3 = \ + ip2int.o + +$(TARGET3): $(target_objs3) + $(CC) $(LDFLAGS) -o $@ $(target_objs3) + + +target_objs4 = \ + sock1.o + +$(TARGET4): $(target_objs4) + $(CC) $(LDFLAGS) -o $@ $(target_objs4) + + +target_objs5 = \ + tmp1.o + +$(TARGET5): $(target_objs5) + $(CC) $(LDFLAGS) -o $@ $(target_objs5) + + +echo-client.o: \ + echo-client.c + +echo-server.o: \ + echo-server.c + +int2ip.o: \ + int2ip.c + +ip2int.o: \ + ip2int.c + +sock1.o: \ + sock1.c + +tmp1.o: \ + tmp1.c + diff --git a/c/echo_server/Makefile b/c/echo_server/Makefile new file mode 100644 index 0000000..9ad0b7e --- /dev/null +++ b/c/echo_server/Makefile @@ -0,0 +1,155 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES= +TARGET0=echo-client +TARGET1=echo-server +TARGET2=sock1 +TARGET3=tmp1 +TARGET4=int2ip +TARGET5=ip2int +TARGET= $(TARGET0) $(TARGET1) $(TARGET2) $(TARGET3) $(TARGET4) $(TARGET5) +INCLUDE1=-I$(HOME)/projects/include +INCLUDE2=-I/usr/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + echo-client.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +target_objs1 = \ + echo-server.o + +$(TARGET1): $(target_objs1) + $(CC) $(LDFLAGS) -o $@ $(target_objs1) + + +target_objs2 = \ + sock1.o + +$(TARGET2): $(target_objs2) + $(CC) $(LDFLAGS) -o $@ $(target_objs2) + + +target_objs3 = \ + tmp1.o + +$(TARGET3): $(target_objs3) + $(CC) $(LDFLAGS) -o $@ $(target_objs3) + + +target_objs4 = \ + int2ip.o + +$(TARGET4): $(target_objs4) + $(CC) $(LDFLAGS) -o $@ $(target_objs4) + + +target_objs5 = \ + ip2int.o + +$(TARGET5): $(target_objs5) + $(CC) $(LDFLAGS) -o $@ $(target_objs5) + + +echo-client.o: \ + echo-client.c + +echo-server.o: \ + echo-server.c + +sock1.o: \ + sock1.c + +tmp1.o: \ + tmp1.c + +int2ip.o: \ + int2ip.c + +ip2int.o: \ + ip2int.c + diff --git a/c/fcntl_ex/Makefile b/c/fcntl_ex/Makefile new file mode 100644 index 0000000..6c74963 --- /dev/null +++ b/c/fcntl_ex/Makefile @@ -0,0 +1,100 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES= +TARGET0=fcntl_lockfile +TARGET= $(TARGET0) +INCLUDE1=-I$(HOME)/projects/include +INCLUDE2=-I/usr/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + fcntl_lockfile.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +fcntl_lockfile.o: \ + fcntl_lockfile.c + diff --git a/c/flipped_webcam/Makefile b/c/flipped_webcam/Makefile new file mode 100644 index 0000000..757a36b --- /dev/null +++ b/c/flipped_webcam/Makefile @@ -0,0 +1,100 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES= +TARGET0=flipped_webcam +TARGET= $(TARGET0) +INCLUDE1=-I$(HOME)/projects/include +INCLUDE2=-I/usr/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + flipped_webcam.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +flipped_webcam.o: \ + flipped_webcam.c + diff --git a/c/fopen_too_many_files/Makefile b/c/fopen_too_many_files/Makefile new file mode 100644 index 0000000..7bbc470 --- /dev/null +++ b/c/fopen_too_many_files/Makefile @@ -0,0 +1,100 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES= +TARGET0=fopen_too_many_files +TARGET= $(TARGET0) +INCLUDE1=-I$(HOME)/projects/include +INCLUDE2=-I/usr/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + fopen_too_many_files.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +fopen_too_many_files.o: \ + fopen_too_many_files.c + diff --git a/c/fopen_too_many_files/fopen_too_many_files b/c/fopen_too_many_files/fopen_too_many_files deleted file mode 100755 index 83f5fee..0000000 Binary files a/c/fopen_too_many_files/fopen_too_many_files and /dev/null differ diff --git a/c/fork_ex/Makefile b/c/fork_ex/Makefile new file mode 100644 index 0000000..7d086e1 --- /dev/null +++ b/c/fork_ex/Makefile @@ -0,0 +1,100 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES= +TARGET0=fork_address_space +TARGET= $(TARGET0) +INCLUDE1=-I$(HOME)/projects/include +INCLUDE2=-I/usr/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + fork_address_space.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +fork_address_space.o: \ + fork_address_space.c + diff --git a/c/fork_ex/fork_address_space b/c/fork_ex/fork_address_space deleted file mode 100755 index 69231f6..0000000 Binary files a/c/fork_ex/fork_address_space and /dev/null differ diff --git a/c/getc/Makefile b/c/getc/Makefile new file mode 100644 index 0000000..d8b2568 --- /dev/null +++ b/c/getc/Makefile @@ -0,0 +1,100 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES= +TARGET0=tmp2 +TARGET= $(TARGET0) +INCLUDE1=-I$(HOME)/projects/include +INCLUDE2=-I/usr/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + tmp2.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +tmp2.o: \ + tmp2.c + diff --git a/c/glcube/Makefile b/c/glcube/Makefile new file mode 100644 index 0000000..74537cf --- /dev/null +++ b/c/glcube/Makefile @@ -0,0 +1,100 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES=-lglut +TARGET0=molecule +TARGET= $(TARGET0) +INCLUDE1=-I$(HOME)/projects/include +INCLUDE2=-I/usr/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + molecule.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +molecule.o: \ + molecule.c + diff --git a/c/gmp-chudnovsky/Makefile b/c/gmp-chudnovsky/Makefile new file mode 100644 index 0000000..280da26 --- /dev/null +++ b/c/gmp-chudnovsky/Makefile @@ -0,0 +1,101 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES= +TARGET0=gmp-chudnovsky +TARGET= $(TARGET0) +INCLUDE1=-I$(HOME)/projects/include +INCLUDE2=-I/usr/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + gmp-chudnovsky.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +gmp-chudnovsky.o: \ + gmp-chudnovsky.c \ + $(INCLUDE2)/gmp.h + diff --git a/c/gprof_ex/Makefile b/c/gprof_ex/Makefile new file mode 100644 index 0000000..a3f09b5 --- /dev/null +++ b/c/gprof_ex/Makefile @@ -0,0 +1,100 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES= +TARGET0=collatz +TARGET= $(TARGET0) +INCLUDE1=-I$(HOME)/projects/include +INCLUDE2=-I/usr/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + collatz.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +collatz.o: \ + collatz.c + diff --git a/c/libhash_ex/Makefile b/c/libhash_ex/Makefile index 6957597..652cc45 100644 --- a/c/libhash_ex/Makefile +++ b/c/libhash_ex/Makefile @@ -1,16 +1,33 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| CC=cc CXX=c++ -INCLUDE=-I$(HOME)/projects/include -KOLAN_PROJECTS=$(HOME)/projects -KOLAN_INCLUDE=$(KOLAN_PROJECTS)/include +LIBRARIES=-lhash +TARGET0=libhash_ex +TARGET= $(TARGET0) +INCLUDE1=-I$(HOME)/projects/include +INCLUDE2=-I/usr/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) -# Compiler flags -# if mode variable is empty, setting debug build mode +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| ifeq ($(mode),) mode = debug endif ifeq ($(mode),debug) - CFLAGS = -O0 -g -std=c99 -pedantic -Wextra -Wconversion + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion LDFLAGS = endif ifeq ($(mode),profile) @@ -27,18 +44,16 @@ ifeq ($(mode),release) endif CFLAGS += -Wall -# $(shell pkg-config --cflags libhash) -LDFLAGS += -Wall -lhash -# $(shell pkg-config --libs libhash) +LDFLAGS += -Wall $(LIBRARIES) -all: libhash_ex +all: change_make_options $(TARGET) ifneq ($(mode),debug) ifneq ($(mode),profile) ifneq ($(mode),develop) ifneq ($(mode),release) @echo "Invalid build mode." - @echo "Please use 'make mode=release' or 'make mode=develop' or 'make mode=debug'" + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" @exit 1 endif endif @@ -47,37 +62,39 @@ endif @echo ".........................." @echo "Building on "$(mode)" mode " @echo "CFLAGS=$(CFLAGS)" - @echo "LDLAGS=$(LDFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" @echo ".........................." +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + %.o : - $(CC) -c $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ $< - -libhash_ex: libhash_ex.o - $(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ libhash_ex.o - -libhash_ex.o: libhash_ex.[c,h] mpool.o - -mpool.o: $(KOLAN_INCLUDE)/mpool.[c,h] xerror.o - -netfuncs.o: $(KOLAN_INCLUDE)/netfuncs.[c,h] - -listen.o: listen.[c,h] params.h xerror.o - -cfg_files.o: cfg_files.[c,h] ssdparser.o - -request.o: request.[c,h] ssdparser.o - -ssdparser.o: $(KOLAN_PROJECTS)/multiexpat/inc/ssdparser.[c,h] $(KOLAN_INCLUDE)/c_const.h \ - $(KOLAN_INCLUDE)/map1251.h $(KOLAN_INCLUDE)/insys_parser/tags.h $(KOLAN_INCLUDE)/insys_parser/const.h xmalloc.o - -xmalloc.o: $(KOLAN_INCLUDE)/xmalloc.[c,h] xerror.o - -signals.o: signals.[c,h] xerror.o - -xerror.o: $(KOLAN_INCLUDE)/xerror.[c,h] + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< clean: - $(RM) *.o *.out callgrind.out.* *.gcno dataserver echo-client + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + libhash_ex.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +libhash_ex.o: \ + libhash_ex.c -.PHONY: all clean diff --git a/c/libhash_ex/libhash_ex b/c/libhash_ex/libhash_ex deleted file mode 100755 index a45c2ce..0000000 Binary files a/c/libhash_ex/libhash_ex and /dev/null differ diff --git a/c/liblist/examples/Makefile b/c/liblist/examples/Makefile index 4eaf681..54f9f76 100644 --- a/c/liblist/examples/Makefile +++ b/c/liblist/examples/Makefile @@ -1,49 +1,125 @@ -# Makefile for generic linked list examples. -# -# Last edited: Tue Jul 28 15:36:13 1992 by bcs (Bradley C. Spatz) on wasp -# -# Copyright (C) 1992 Bradley C. Spatz, bcs@ufl.edu -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -#CC = /local/bin/gcc -#CFLAGS = $(INCLUDES) -fstrength-reduce -finline-functions -PACKAGE_VERSION=2.3.1 -CFLAGS += $(INCLUDES) -INCLUDES= -I.. -LIBS = -L.. -llist -#LIBS = -L .. -llist # Use this for HP-UX; great loader guys! -#add macro for ranlib 4/96 *kob* - ranlib doesn't exist on solaris -RANLIB = ls -# -all: listtest queuetest stacktest - (cd cache; make) +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to -listtest: listtest.o ../liblist.a - $(CC) $(CFLAGS) -o listtest listtest.o $(LIBS) +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES=-llist +TARGET0=listtest +TARGET1=queuetest +TARGET2=stacktest +TARGET= $(TARGET0) $(TARGET1) $(TARGET2) +INCLUDE1=-I$(HOME)/projects/include +INCLUDE2=-I/usr/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) -queuetest: queuetest.o ../liblist.a - $(CC) $(CFLAGS) -o queuetest queuetest.o $(LIBS) +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif -stacktest: stacktest.o ../liblist.a - $(CC) $(CFLAGS) -o stacktest stacktest.o $(LIBS) +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< -listtest.o: ../list.h -queuetest.o: ../queue.h -stacktest.o: ../stack.h clean: - rm -f listtest queuetest stacktest *.o core - (cd cache; make clean) + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + listtest.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +target_objs1 = \ + queuetest.o + +$(TARGET1): $(target_objs1) + $(CC) $(LDFLAGS) -o $@ $(target_objs1) + + +target_objs2 = \ + stacktest.o + +$(TARGET2): $(target_objs2) + $(CC) $(LDFLAGS) -o $@ $(target_objs2) + + +listtest.o: \ + listtest.c \ + ../list.h + +queuetest.o: \ + queuetest.c \ + ../queue.h + +stacktest.o: \ + stacktest.c \ + ../stack.h + diff --git a/c/liblist/examples/cache/Makefile b/c/liblist/examples/cache/Makefile new file mode 100644 index 0000000..2e537d3 --- /dev/null +++ b/c/liblist/examples/cache/Makefile @@ -0,0 +1,106 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES= +TARGET0=cachetest +TARGET= $(TARGET0) +INCLUDE1=-I$(HOME)/projects/include +INCLUDE2=-I/usr/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + cachetest.o \ + cache.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +cachetest.o: \ + cachetest.c \ + $(INCLUDE2)/cache.h + +cache.o: \ + cache.c \ + $(INCLUDE2)/cache.h + diff --git a/c/liblist/examples/cache/cachetest b/c/liblist/examples/cache/cachetest deleted file mode 100755 index df4edb2..0000000 Binary files a/c/liblist/examples/cache/cachetest and /dev/null differ diff --git a/c/liblist/examples/listtest b/c/liblist/examples/listtest deleted file mode 100755 index 02fd67f..0000000 Binary files a/c/liblist/examples/listtest and /dev/null differ diff --git a/c/liblist/examples/queuetest b/c/liblist/examples/queuetest deleted file mode 100755 index 4634ef3..0000000 Binary files a/c/liblist/examples/queuetest and /dev/null differ diff --git a/c/liblist/examples/stacktest b/c/liblist/examples/stacktest deleted file mode 100755 index df0dd44..0000000 Binary files a/c/liblist/examples/stacktest and /dev/null differ diff --git a/c/list/Makefile b/c/list/Makefile new file mode 100644 index 0000000..a998eda --- /dev/null +++ b/c/list/Makefile @@ -0,0 +1,100 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES= +TARGET0=list_kernel +TARGET= $(TARGET0) +INCLUDE1=-I$(HOME)/projects/include +INCLUDE2=-I/usr/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + list_kernel.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +list_kernel.o: \ + list_kernel.c + diff --git a/c/malloc_speed_test/Makefile b/c/malloc_speed_test/Makefile new file mode 100644 index 0000000..85e0738 --- /dev/null +++ b/c/malloc_speed_test/Makefile @@ -0,0 +1,145 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES=-lstdc++ +TARGET0=malloc_speed_test +TARGET1=mpool_test +TARGET2=pool_list +TARGET3=vector_add +TARGET= $(TARGET0) $(TARGET1) $(TARGET2) $(TARGET3) +INCLUDE1=$(HOME)/projects/include +INCLUDE2=/usr/local/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + malloc_speed_test.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +target_objs1 = \ + mpool_test.o \ + mpool.o \ + xerror.o + +$(TARGET1): $(target_objs1) + $(CC) $(LDFLAGS) -o $@ $(target_objs1) + + +target_objs2 = \ + pool_list.o + +$(TARGET2): $(target_objs2) + $(CC) $(LDFLAGS) -o $@ $(target_objs2) + + +target_objs3 = \ + vector_add.o + +$(TARGET3): $(target_objs3) + $(CC) $(LDFLAGS) -o $@ $(target_objs3) + + +malloc_speed_test.o: \ + malloc_speed_test.c + +mpool_test.o: \ + mpool_test.c \ + $(INCLUDE1)/mpool.h + +pool_list.o: \ + pool_list.c + +vector_add.o: \ + vector_add.cpp + +mpool.o: \ + $(INCLUDE1)/mpool.c \ + $(INCLUDE1)/mpool.h \ + $(INCLUDE1)/xerror.h + +xerror.o: \ + $(INCLUDE1)/xerror.c \ + $(INCLUDE1)/xerror.h + diff --git a/c/malloc_speed_test/const.h b/c/malloc_speed_test/const.h deleted file mode 100644 index 1745981..0000000 --- a/c/malloc_speed_test/const.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef CONST_H -#define CONST_H - -#ifndef TRUE - #define TRUE (1) -#endif - -#ifndef FALSE - #define FALSE (0) -#endif - -#endif // CONST_H diff --git a/c/malloc_speed_test/mpool.c b/c/malloc_speed_test/mpool.c deleted file mode 100644 index 9ada81d..0000000 --- a/c/malloc_speed_test/mpool.c +++ /dev/null @@ -1,100 +0,0 @@ -#include "mpool.h" - -/* - * инициализация пула - */ -void mpool_init(struct mpool_s *bp, size_t nblocks, size_t mpool_block_size) -{ - size_t i; - - bp->nblocks = nblocks; - - mpool_block_size += 2 * sizeof(struct mpool_block_s *); - - bp->pool = (struct mpool_block_s *)malloc(nblocks * mpool_block_size); - - if (!bp->pool) - fatal("virtual memory exhaused"); - - void *p = bp->pool + mpool_block_size, - *pmax = p + (nblocks - 2) * mpool_block_size; - - for ( ; p < pmax; p += mpool_block_size) { - ((struct mpool_block_s *)p)->prev = (struct mpool_block_s *)(p - mpool_block_size); - ((struct mpool_block_s *)p)->next = (struct mpool_block_s *)(p + mpool_block_size); - } - - ((struct mpool_block_s *)bp->pool)->prev = NULL; - ((struct mpool_block_s *)bp->pool)->next = (struct mpool_block_s *)(bp->pool + mpool_block_size); - - ((struct mpool_block_s *)(bp->pool + (nblocks - 1) * mpool_block_size))->prev = - (struct mpool_block_s *)(bp->pool + (nblocks - 2) * mpool_block_size); - ((struct mpool_block_s *)(bp->pool + (nblocks - 1) * mpool_block_size))->next = NULL; - - bp->free_pool = (struct mpool_block_s *)bp->pool; - bp->busy_pool = NULL; -} - -/* - * уничтожение пула - */ -void mpool_destroy(struct mpool_s *bp) -{ - free(bp->pool); - bp->nblocks = 0; - bp->pool = bp->free_pool = bp->busy_pool = NULL; -} - -/* - * выдача блока из пула - */ -void *mpool_alloc(struct mpool_s *bp) -{ - if (!bp->free_pool) - return NULL; - - bp->free_pool->prev = bp->free_pool->next; // save free_pool->next in free_pool->prev - - bp->free_pool->next = bp->busy_pool; - - if (bp->busy_pool) - bp->busy_pool->prev = bp->free_pool; - - bp->busy_pool = bp->free_pool; - - bp->free_pool = bp->free_pool->prev; - - bp->busy_pool->prev = NULL; // saved in free_pool->prev to NULL - - return &bp->busy_pool->obj; -} - -/* - * возвращение блока в пул - */ -void mpool_free(struct mpool_s *bp, void *p) -{ - if (!p) - return; - - struct mpool_block_s *b1 = (struct mpool_block_s *)(p - 2 * sizeof(struct mpool_block_s *)), - *b2 = b1->next; - - if (b1->prev) - b1->prev->next = b2; - if (b2) - b2->prev = b1->prev; - - if (bp->free_pool) { - b1->next = bp->free_pool; - bp->free_pool->prev = b1; - } - else - b1->next = NULL; - - bp->free_pool = b2; - - if (bp->busy_pool == b1) - bp->busy_pool = b2; -} - diff --git a/c/malloc_speed_test/mpool.h b/c/malloc_speed_test/mpool.h deleted file mode 100644 index 1f941a0..0000000 --- a/c/malloc_speed_test/mpool.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef MPOOL_H -#define MPOOL_H - -#include - -#include "const.h" - -struct mpool_block_s { - struct mpool_block_s *next; - struct mpool_block_s *prev; - char obj; -}; - -struct mpool_s { - size_t nblocks; - void *pool; - struct mpool_block_s *free_pool; - struct mpool_block_s *busy_pool; -}; - -/* - * инициализация пула - */ -void mpool_init(struct mpool_s *bp, size_t nblocks, size_t mpool_block_size); - -/* - * уничтожение пула - */ -void mpool_destroy(struct mpool_s *bp); - -/* - * выдача блока из пула - */ -void *mpool_alloc(struct mpool_s *bp); - -/* - * возвращение блока в пул - */ -void mpool_free(struct mpool_s *bp, void *p); - -#endif // MPOOL_H - diff --git a/c/malloc_speed_test/xerror.c b/c/malloc_speed_test/xerror.c deleted file mode 100644 index f40c1d6..0000000 --- a/c/malloc_speed_test/xerror.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "xerror.h" - -#include -#include -#include - -void fatal(const char *s) -{ - perror(s); - exit(-1); -} diff --git a/c/malloc_speed_test/xerror.h b/c/malloc_speed_test/xerror.h deleted file mode 100644 index d8c64f7..0000000 --- a/c/malloc_speed_test/xerror.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef XERROR_H -#define XERROR_H - -void fatal(const char *s); - -#endif // XERORR_H diff --git a/c/masync_server/Makefile b/c/masync_server/Makefile index f34992a..1f25412 100644 --- a/c/masync_server/Makefile +++ b/c/masync_server/Makefile @@ -1,64 +1,125 @@ -TARGET=$(shell basename `pwd`) -SOURCES=$(wildcard *.c) -OBJECTS=$(SOURCES:%.c=%.o) +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to -#CFLAGS=-march=core2 -mtune=core2 -O2 -mfpmath=sse -msse4.1 -pipe -#LDFLAGS=-Wl,-O1 -Wl,--as-needed +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES=-lpthread +TARGET0=echo-client +TARGET1=echo-server +TARGET= $(TARGET0) $(TARGET1) +INCLUDE1=$(HOME)/projects/include +INCLUDE2=/usr/local/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) -CFLAGS+=-g $(shell pkg-config --cflags liblist) -LDFLAGS+=$(shell pkg-config --libs liblist) -lpthread +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif -all: $(TARGET) echo-server echo-client +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) -$(OBJECTS): $(SOURCES) +all: change_make_options $(TARGET) -$(TARGET): $(OBJECTS) +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." -echo-server: echo-server.o xerror.o +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif -echo-client: echo-client.o xerror.o +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< clean: - $(RM) $(OBJECTS) $(TARGET) echo-server echo-client + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) -.PHONY: all clean +.PHONY: all change_make_options clean -# c++ -#TARGET=$(shell basename `pwd`) -#SOURCES=$(wildcard *.cpp) -#OBJECTS=$(SOURCES:%.cpp=%.o) -# -#all: $(TARGET) -# -#$(OBJECTS): $(SOURCES) -# -#$(TARGET): $(OBJECTS) -# $(CXX) -o $(TARGET) $(LDFLAGS) $(OBJECTS) $(LOADLIBES) $(LDLIBS) -# -#clean: -# $(RM) $(OBJECTS) $(TARGET) -# -#.PHONY: all clean +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + echo-client.o \ + netfuncs.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) -#CC=gcc -#CFLAGS=-c -Wall -##LDFLAGS= -##INCLUDES=-I.. ./inc -##LIBS=-L. --llist -# -## all: standserver test_xmalloc -# -#all: xerror.o xmalloc.o -# -#standserver: standserver.o xmalloc.o -# $(CC) $(CFLAGS) standserver.o xmalloc.o -o standserver -# -#xmalloc.o: -# $(CC) $(CFLAGS) xmalloc.c -# -#xerror.o: -# $(CC) $(CFLAGS) xerror.c -# -#clean: -# rm -rf *.o *.gch standserver test_xmalloc +target_objs1 = \ + echo-server.o \ + netfuncs.o \ + xerror.o + +$(TARGET1): $(target_objs1) + $(CC) $(LDFLAGS) -o $@ $(target_objs1) + + +echo-client.o: \ + echo-client.c \ + netfuncs.h + +echo-server.o: \ + echo-server.c \ + netfuncs.h \ + xerror.h + +netfuncs.o: \ + netfuncs.c \ + netfuncs.h + +xerror.o: \ + xerror.c \ + xerror.h + diff --git a/c/mstats_ex/Makefile b/c/mstats_ex/Makefile new file mode 100644 index 0000000..e92d971 --- /dev/null +++ b/c/mstats_ex/Makefile @@ -0,0 +1,100 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES= +TARGET0=mstats_ex +TARGET= $(TARGET0) +INCLUDE1=$(HOME)/projects/include +INCLUDE2=/usr/local/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + mstats_ex.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +mstats_ex.o: \ + mstats_ex.c + diff --git a/c/pthread_ex/Makefile b/c/pthread_ex/Makefile new file mode 100644 index 0000000..84ee28f --- /dev/null +++ b/c/pthread_ex/Makefile @@ -0,0 +1,100 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES=-lpthread +TARGET0=pthread_rwlock_ex +TARGET= $(TARGET0) +INCLUDE1=$(HOME)/projects/include +INCLUDE2=/usr/local/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + pthread_rwlock_ex.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +pthread_rwlock_ex.o: \ + pthread_rwlock_ex.c + diff --git a/c/realloc_speed_test/Makefile b/c/realloc_speed_test/Makefile index 5084ffb..cd5db98 100644 --- a/c/realloc_speed_test/Makefile +++ b/c/realloc_speed_test/Makefile @@ -1,47 +1,60 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| CC=cc CXX=c++ -INCLUDE=-I$(HOME)/projects/include -KOLAN_PROJECTS=$(HOME)/projects -KOLAN_INCLUDE=$(KOLAN_PROJECTS)/include +LIBRARIES=-lstdc++ +TARGET0=realloc_speed_test_c +TARGET1=realloc_speed_test_cpp +TARGET= $(TARGET0) $(TARGET1) +INCLUDE1=$(HOME)/projects/include +INCLUDE2=/usr/local/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) -# Compiler flags -# if mode variable is empty, setting debug build mode +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| ifeq ($(mode),) mode = debug endif ifeq ($(mode),debug) CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion - CXXFLAGS = -O0 -g -std=c++0x -pedantic -Wextra -Wconversion LDFLAGS = endif ifeq ($(mode),profile) CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch - CXXFLAGS =$(CFLAGS) LDFLAGS = -g -p endif ifeq ($(mode),develop) CFLAGS += -O2 -g - CXXFLAGS = $(CFLAGS) LDFLAGS += -O1 endif ifeq ($(mode),release) CFLAGS += -O2 - CXXFLAGS = $(CFLAGS) LDFLAGS += -O1 endif -CFLAGS += -Wall $(shell pkg-config --cflags liblist) -CXXFLAGS += -Wall $(shell pkg-config --cflags liblist) -LDFLAGS += -Wall $(shell pkg-config --libs liblist) -lpthread -lexpat +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) -all: realloc_speed_test_c realloc_speed_test_cpp +all: change_make_options $(TARGET) ifneq ($(mode),debug) ifneq ($(mode),profile) ifneq ($(mode),develop) ifneq ($(mode),release) @echo "Invalid build mode." - @echo "Please use 'make mode=release' or 'make mode=develop' or 'make mode=debug'" + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" @exit 1 endif endif @@ -50,30 +63,61 @@ endif @echo ".........................." @echo "Building on "$(mode)" mode " @echo "CFLAGS=$(CFLAGS)" - @echo "CXXFLAGS=$(CXXFLAGS)" - @echo "LDLAGS=$(LDFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" @echo ".........................." -realloc_speed_test_cpp: realloc_speed_test_cpp.o - $(CXX) $(CXXFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ realloc_speed_test_cpp.o - -realloc_speed_test_cpp.o: realloc_speed_test_cpp.[c,h]pp - $(CXX) -c $(CXXFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ realloc_speed_test_cpp.cpp +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif %.o : - $(CC) -c $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ $< - -realloc_speed_test_c_obj = realloc_speed_test_c.o xalloc.o xerror.o -realloc_speed_test_c: $(realloc_speed_test_c_obj) - $(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ $(realloc_speed_test_c_obj) - -realloc_speed_test_c.o: realloc_speed_test_c.[c,h] xalloc.o - -xalloc.o: $(KOLAN_INCLUDE)/xalloc.c $(KOLAN_INCLUDE)/xalloc.h xerror.o - -xerror.o: $(KOLAN_INCLUDE)/xerror.[c,h] + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< clean: - $(RM) *.o *.out callgrind.out.* *.gcno realloc_speed_test_cpp realloc_speed_test_c + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + realloc_speed_test_c.o \ + xalloc.o \ + xerror.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +target_objs1 = \ + realloc_speed_test_cpp.o + +$(TARGET1): $(target_objs1) + $(CC) $(LDFLAGS) -o $@ $(target_objs1) + + +realloc_speed_test_c.o: \ + realloc_speed_test_c.c \ + $(INCLUDE1)/xalloc.h + +realloc_speed_test_cpp.o: \ + realloc_speed_test_cpp.cpp + +xalloc.o: \ + $(INCLUDE1)/xalloc.c \ + $(INCLUDE1)/xalloc.h \ + $(INCLUDE1)/xerror.h + +xerror.o: \ + $(INCLUDE1)/xerror.c \ + $(INCLUDE1)/xerror.h -.PHONY: all clean diff --git a/c/stat/Makefile b/c/stat/Makefile new file mode 100644 index 0000000..7196930 --- /dev/null +++ b/c/stat/Makefile @@ -0,0 +1,100 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES= +TARGET0=stattest +TARGET= $(TARGET0) +INCLUDE1=$(HOME)/projects/include +INCLUDE2=/usr/local/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + stattest.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +stattest.o: \ + stattest.c + diff --git a/c/study/Makefile b/c/study/Makefile new file mode 100644 index 0000000..3a227b0 --- /dev/null +++ b/c/study/Makefile @@ -0,0 +1,100 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES= +TARGET0=sigaction +TARGET= $(TARGET0) +INCLUDE1=$(HOME)/projects/include +INCLUDE2=/usr/local/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + sigaction.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +sigaction.o: \ + sigaction.c + diff --git a/c/sysctl_ex/Makefile b/c/sysctl_ex/Makefile new file mode 100644 index 0000000..a9b2337 --- /dev/null +++ b/c/sysctl_ex/Makefile @@ -0,0 +1,100 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES= +TARGET0=_sysctl_ex +TARGET= $(TARGET0) +INCLUDE1=$(HOME)/projects/include +INCLUDE2=/usr/local/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + _sysctl_ex.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +_sysctl_ex.o: \ + _sysctl_ex.c + diff --git a/c/tex_parser/tex_parser.geany b/c/tex_parser/tex_parser.geany index 44f8138..9c2c7b2 100644 --- a/c/tex_parser/tex_parser.geany +++ b/c/tex_parser/tex_parser.geany @@ -19,9 +19,9 @@ long_line_column=72 current_page=4 FILE_NAME_0=21;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser_test.c;0 FILE_NAME_1=298;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser.c;0 -FILE_NAME_2=321;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser.h;0 +FILE_NAME_2=0;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser.h;0 FILE_NAME_3=133;C;0;16;1;1;1;/home/kolan/dev/c/tex_parser/tex_parser_tags.h;0 -FILE_NAME_4=1884;Make;0;16;1;1;1;/home/kolan/dev/c/tex_parser/Makefile;0 +FILE_NAME_4=1146;Make;0;16;1;1;1;/home/kolan/dev/c/tex_parser/Makefile;0 [build-menu] NF_00_LB=_Сделать diff --git a/c/the_end/Makefile b/c/the_end/Makefile new file mode 100644 index 0000000..7a65fe5 --- /dev/null +++ b/c/the_end/Makefile @@ -0,0 +1,100 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| +CC=cc +CXX=c++ +LIBRARIES= +TARGET0=the_end +TARGET= $(TARGET0) +INCLUDE1=$(HOME)/projects/include +INCLUDE2=/usr/local/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) + +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| +ifeq ($(mode),) + mode = debug +endif +ifeq ($(mode),debug) + CFLAGS = -O0 -g -std=gnu99 -pedantic -Wextra -Wconversion + LDFLAGS = +endif +ifeq ($(mode),profile) + CFLAGS = -O0 -g -p -ftest-coverage -Wcoverage-mismatch + LDFLAGS = -g -p +endif +ifeq ($(mode),develop) + CFLAGS += -O2 -g + LDFLAGS += -O1 +endif +ifeq ($(mode),release) + CFLAGS += -O2 + LDFLAGS += -O1 +endif + +CFLAGS += -Wall +LDFLAGS += -Wall $(LIBRARIES) + +all: change_make_options $(TARGET) + +ifneq ($(mode),debug) +ifneq ($(mode),profile) +ifneq ($(mode),develop) +ifneq ($(mode),release) + @echo "Invalid build mode." + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" + @exit 1 +endif +endif +endif +endif + @echo ".........................." + @echo "Building on "$(mode)" mode " + @echo "CFLAGS=$(CFLAGS)" + @echo "LDFLAGS=$(LDFLAGS)" + @echo ".........................." + +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + +%.o : + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< + +clean: + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + the_end.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +the_end.o: \ + the_end.c + diff --git a/c/xalloc/Makefile b/c/xalloc/Makefile index 3ccf227..14a3999 100644 --- a/c/xalloc/Makefile +++ b/c/xalloc/Makefile @@ -1,11 +1,28 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| CC=cc CXX=c++ -INCLUDE=-I$(HOME)/projects/include -KOLAN_PROJECTS=$(HOME)/projects -KOLAN_INCLUDE=$(KOLAN_PROJECTS)/include +LIBRARIES= +TARGET0=xalloc_test +TARGET= $(TARGET0) +INCLUDE1=$(HOME)/projects/include +INCLUDE2=/usr/local/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) -# Compiler flags -# if mode variable is empty, setting debug build mode +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| ifeq ($(mode),) mode = debug endif @@ -27,18 +44,16 @@ ifeq ($(mode),release) endif CFLAGS += -Wall -#~ $(shell pkg-config --cflags liblist) -LDFLAGS += -Wall -#~ $(shell pkg-config --libs liblist) +LDFLAGS += -Wall $(LIBRARIES) -all: xalloc_test +all: change_make_options $(TARGET) ifneq ($(mode),debug) ifneq ($(mode),profile) ifneq ($(mode),develop) ifneq ($(mode),release) @echo "Invalid build mode." - @echo "Please use 'make mode=release' or 'make mode=develop' or 'make mode=debug'" + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" @exit 1 endif endif @@ -50,20 +65,48 @@ endif @echo "LDFLAGS=$(LDFLAGS)" @echo ".........................." +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + %.o : - $(CC) -c $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ $< - -xalloc_test_obj = xalloc.o xerror.o -xalloc_test: xalloc_test.o $(xalloc_test_obj) - $(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ xalloc_test.o $(xalloc_test_obj) - -xalloc_test.o: xalloc_test.c xalloc.o - -xalloc.o: $(KOLAN_INCLUDE)/xalloc.c $(KOLAN_INCLUDE)/xalloc.h - -xerror.o: $(KOLAN_INCLUDE)/xerror.c $(KOLAN_INCLUDE)/xerror.c + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< clean: - $(RM) *.o *.out callgrind.out.* *.gcno xalloc_test + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + xalloc_test.o \ + xalloc.o \ + xerror.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +xalloc_test.o: \ + xalloc_test.c \ + $(INCLUDE1)/xalloc.h + +xalloc.o: \ + $(INCLUDE1)/xalloc.c \ + $(INCLUDE1)/xalloc.h \ + $(INCLUDE1)/xerror.h + +xerror.o: \ + $(INCLUDE1)/xerror.c \ + $(INCLUDE1)/xerror.h -.PHONY: all clean diff --git a/c/zalloc/Makefile b/c/zalloc/Makefile index ba8bea0..2dd05ae 100644 --- a/c/zalloc/Makefile +++ b/c/zalloc/Makefile @@ -1,11 +1,28 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| CC=cc CXX=c++ -INCLUDE=-I$(HOME)/projects/include -KOLAN_PROJECTS=$(HOME)/projects -KOLAN_INCLUDE=$(KOLAN_PROJECTS)/include +LIBRARIES= +TARGET0=zalloc_test +TARGET= $(TARGET0) +INCLUDE1=$(HOME)/projects/include +INCLUDE2=/usr/local/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) -# Compiler flags -# if mode variable is empty, setting debug build mode +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| ifeq ($(mode),) mode = debug endif @@ -27,18 +44,16 @@ ifeq ($(mode),release) endif CFLAGS += -Wall -#~ $(shell pkg-config --cflags liblist) -LDFLAGS += -Wall -#~ $(shell pkg-config --libs liblist) +LDFLAGS += -Wall $(LIBRARIES) -all: zalloc_test +all: change_make_options $(TARGET) ifneq ($(mode),debug) ifneq ($(mode),profile) ifneq ($(mode),develop) ifneq ($(mode),release) @echo "Invalid build mode." - @echo "Please use 'make mode=release' or 'make mode=develop' or 'make mode=debug'" + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" @exit 1 endif endif @@ -50,20 +65,48 @@ endif @echo "LDFLAGS=$(LDFLAGS)" @echo ".........................." +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + %.o : - $(CC) -c $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ $< - -zalloc_test_obj = zalloc.o xerror.o -zalloc_test: zalloc_test.o $(zalloc_test_obj) - $(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ zalloc_test.o $(zalloc_test_obj) - -zalloc_test.o: zalloc_test.c zalloc.o - -zalloc.o: $(KOLAN_INCLUDE)/zalloc.c $(KOLAN_INCLUDE)/zalloc.h - -xerror.o: $(KOLAN_INCLUDE)/xerror.c $(KOLAN_INCLUDE)/xerror.c + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< clean: - $(RM) *.o *.out callgrind.out.* *.gcno zalloc_test + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + zalloc_test.o \ + xerror.o \ + zalloc.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +zalloc_test.o: \ + zalloc_test.c \ + $(INCLUDE1)/zalloc.h + +zalloc.o: \ + $(INCLUDE1)/zalloc.c \ + $(INCLUDE1)/xerror.h \ + $(INCLUDE1)/zalloc.h + +xerror.o: \ + $(INCLUDE1)/xerror.c \ + $(INCLUDE1)/xerror.h -.PHONY: all clean diff --git a/c/zalloc_ext/Makefile b/c/zalloc_ext/Makefile index 83a08d9..b13e336 100644 --- a/c/zalloc_ext/Makefile +++ b/c/zalloc_ext/Makefile @@ -1,11 +1,28 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| CC=cc CXX=c++ -INCLUDE=-I$(HOME)/projects/include -KOLAN_PROJECTS=$(HOME)/projects -KOLAN_INCLUDE=$(KOLAN_PROJECTS)/include +LIBRARIES= +TARGET0=zalloc_ext_test +TARGET= $(TARGET0) +INCLUDE1=$(HOME)/projects/include +INCLUDE2=/usr/local/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) -# Compiler flags -# if mode variable is empty, setting debug build mode +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| ifeq ($(mode),) mode = debug endif @@ -27,18 +44,16 @@ ifeq ($(mode),release) endif CFLAGS += -Wall -#~ $(shell pkg-config --cflags liblist) -LDFLAGS += -Wall -#~ $(shell pkg-config --libs liblist) +LDFLAGS += -Wall $(LIBRARIES) -all: zalloc_ext_test +all: change_make_options $(TARGET) ifneq ($(mode),debug) ifneq ($(mode),profile) ifneq ($(mode),develop) ifneq ($(mode),release) @echo "Invalid build mode." - @echo "Please use 'make mode=release' or 'make mode=develop' or 'make mode=debug'" + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" @exit 1 endif endif @@ -50,24 +65,62 @@ endif @echo "LDFLAGS=$(LDFLAGS)" @echo ".........................." +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + %.o : - $(CC) -c $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ $< - -zalloc_ext_test_obj = zalloc_ext.o zalloc.o xalloc.o xerror.o -zalloc_ext_test: zalloc_ext_test.o $(zalloc_ext_test_obj) - $(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ zalloc_ext_test.o $(zalloc_ext_test_obj) - -zalloc_ext_test.o: zalloc_ext_test.c zalloc_ext.o zalloc.o - -zalloc_ext.o: $(KOLAN_INCLUDE)/zalloc_ext.c $(KOLAN_INCLUDE)/zalloc_ext.h - -zalloc.o: $(KOLAN_INCLUDE)/zalloc.c $(KOLAN_INCLUDE)/zalloc.h - -xalloc.o: $(KOLAN_INCLUDE)/xalloc.c $(KOLAN_INCLUDE)/xalloc.h - -xerror.o: $(KOLAN_INCLUDE)/xerror.c $(KOLAN_INCLUDE)/xerror.c + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< clean: - $(RM) *.o *.out callgrind.out.* *.gcno zalloc_ext_test + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + zalloc_ext_test.o \ + xalloc.o \ + xerror.o \ + zalloc.o \ + zalloc_ext.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +zalloc_ext_test.o: \ + zalloc_ext_test.c \ + $(INCLUDE1)/xalloc.h \ + $(INCLUDE1)/zalloc.h \ + $(INCLUDE1)/zalloc_ext.h + +xalloc.o: \ + $(INCLUDE1)/xalloc.c \ + $(INCLUDE1)/xalloc.h \ + $(INCLUDE1)/xerror.h + +zalloc.o: \ + $(INCLUDE1)/zalloc.c \ + $(INCLUDE1)/xerror.h \ + $(INCLUDE1)/zalloc.h + +zalloc_ext.o: \ + $(INCLUDE1)/zalloc_ext.c \ + $(INCLUDE1)/zalloc.h \ + $(INCLUDE1)/zalloc_ext.h + +xerror.o: \ + $(INCLUDE1)/xerror.c \ + $(INCLUDE1)/xerror.h -.PHONY: all clean diff --git a/c/zerror_test/Makefile b/c/zerror_test/Makefile index 80c796a..1b06615 100644 --- a/c/zerror_test/Makefile +++ b/c/zerror_test/Makefile @@ -1,11 +1,28 @@ +# This file is generated with smake.sh. +# You can use this make file with instruction make to +# use one of build mode: debug, profile, develop, release. +# No need to call make clean if You make with other mode, +# because the Makefile containes rules for automatically clean. +# Some usage examples: +# CFLAGS="-march=core2 -mtune=core2" make +# LDFLAGS="-lexpat" make mode=profile +# Report bugs to + +#_________________________________ +# ENVIRONMENT | +#________________________________| CC=cc CXX=c++ -INCLUDE=-I$(HOME)/projects/include -KOLAN_PROJECTS=$(HOME)/projects -KOLAN_INCLUDE=$(KOLAN_PROJECTS)/include +LIBRARIES= +TARGET0=zerror_test +TARGET= $(TARGET0) +INCLUDE1=$(HOME)/projects/include +INCLUDE2=/usr/local/include +INCLUDE=-I$(INCLUDE1) -I$(INCLUDE2) -# Compiler flags -# if mode variable is empty, setting debug build mode +#________________________________________ +# BUILD SCRIPT (don't change) | +#_______________________________________| ifeq ($(mode),) mode = debug endif @@ -27,18 +44,16 @@ ifeq ($(mode),release) endif CFLAGS += -Wall -#~ $(shell pkg-config --cflags liblist) -LDFLAGS += -Wall -#~ $(shell pkg-config --libs liblist) -lpthread -lexpat +LDFLAGS += -Wall $(LIBRARIES) -all: zerror_test +all: change_make_options $(TARGET) ifneq ($(mode),debug) ifneq ($(mode),profile) ifneq ($(mode),develop) ifneq ($(mode),release) @echo "Invalid build mode." - @echo "Please use 'make mode=release', 'make mode=develop' or 'make mode=debug'" + @echo "Please use 'make mode=release', 'make mode=develop', 'make mode=profile' or 'make mode=debug'" @exit 1 endif endif @@ -50,20 +65,48 @@ endif @echo "LDFLAGS=$(LDFLAGS)" @echo ".........................." +OLD_BUILD_MODE=$(shell grep ^MODE make_options.out 2>/dev/null | sed 's~^MODE=~~') +OLD_BUILD_CFLAGS=$(shell grep ^CFLAGS make_options.out 2>/dev/null | sed 's~^CFLAGS=~~') +OLD_BUILD_LDFLAGS=$(shell grep ^LDFLAGS make_options.out 2>/dev/null | sed 's~^LDFLAGS=~~') +change_make_options: +ifneq ($(mode)|$(CFLAGS)|$(LDFLAGS), $(OLD_BUILD_MODE)|$(OLD_BUILD_CFLAGS)|$(OLD_BUILD_LDFLAGS)) + @echo CLEANING... + @make clean &>/dev/null + @echo MODE=$(mode) > make_options.out + @echo CFLAGS=$(CFLAGS) >> make_options.out + @echo LDFLAGS=$(LDFLAGS) >> make_options.out +endif + %.o : - $(CC) -c $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ $< - -zerror_test_obj = zerror_test.o zerror.o xerror.o -zerror_test: $(zerror_test_obj) - $(CC) $(CFLAGS) $(LDFLAGS) $(INCLUDE) -o $@ $(zerror_test_obj) - -zerror_test.o: zerror_test.c $(KOLAN_INCLUDE)/zerror.h $(KOLAN_INCLUDE)/xerror.h - -zerror.o: $(KOLAN_INCLUDE)/zerror.c $(KOLAN_INCLUDE)/zerror.h $(KOLAN_INCLUDE)/xerror.h - -xerror.o: $(KOLAN_INCLUDE)/xerror.c $(KOLAN_INCLUDE)/xerror.h + $(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $< clean: - $(RM) *.o *.out callgrind.out.* *.gcno tex_parser_test + $(RM) *.o *.out callgrind.out.* *.gcno $(TARGET) + +.PHONY: all change_make_options clean + +#_________________________________ +# R U L E S | +#________________________________| +target_objs0 = \ + zerror_test.o \ + xerror.o \ + zerror.o + +$(TARGET0): $(target_objs0) + $(CC) $(LDFLAGS) -o $@ $(target_objs0) + + +zerror_test.o: \ + zerror_test.c \ + $(INCLUDE1)/zerror.h + +zerror.o: \ + $(INCLUDE1)/zerror.c \ + $(INCLUDE1)/xerror.h \ + $(INCLUDE1)/zerror.h + +xerror.o: \ + $(INCLUDE1)/xerror.c \ + $(INCLUDE1)/xerror.h -.PHONY: all clean diff --git a/c/zerror_test/zerror_test.c b/c/zerror_test/zerror_test.c index 7c89e55..6ceb9c1 100644 --- a/c/zerror_test/zerror_test.c +++ b/c/zerror_test/zerror_test.c @@ -52,7 +52,7 @@ void test0() printf("z_propagate_prefixed_error = {%d, %d, %s}\n", zs_pe2->domain, zs_pe2->code, zs_pe2->message); zerror_free(zs); - zs_l = zerror_free_null(zs_l); + z_clear_error(&zs_l); zerror_free(zs_cp); //~ z_clear_error(&zs_se_l); // not need clear, because zs_se_l propagated to zs_pe2 //~ z_clear_error(&zs_se); // not need clear, because zs_se propagated to zs_pe