Compare commits
4 Commits
32fbc9c08c
...
aa172de2cf
Author | SHA1 | Date |
---|---|---|
Daniel Santos | aa172de2cf | |
Daniel Santos | ff971aaa63 | |
Daniel Santos | 6fbbcbd9e1 | |
Daniel Santos | 3020dad2ff |
|
@ -1,2 +1,3 @@
|
|||
/*-to-*
|
||||
*.o
|
||||
/*.o
|
||||
/lib
|
||||
|
|
33
Makefile
33
Makefile
|
@ -1,18 +1,35 @@
|
|||
CC := c99
|
||||
CFLAGS := -Wall -Wextra -O2
|
||||
DEP := cli.c numericx.o
|
||||
|
||||
.PHONY: all
|
||||
all: decimal-to-earth earth-to-decimal decimal-to-sun sun-to-decimal decimal-to-lori decimal-to-nonal_inf decimal-to-nonal lori-to-decimal nonal_inf-to-decimal nonal-to-decimal uninfinity decimal-to-binary binary-to-decimal
|
||||
|
||||
numericx.o: numericx.c
|
||||
$(CC) $(CFLAGS) -c $^
|
||||
.PHONY: lib-dirs
|
||||
lib-dirs:
|
||||
@mkdir -p lib/{static,shared}
|
||||
|
||||
numericx.o: numericx.c numericx.h
|
||||
$(CC) $(CFLAGS) -c numericx.c
|
||||
|
||||
.PHONY: libnumericx.a libnumericx.so
|
||||
libnumericx.a: numericx.o
|
||||
ar -rc libnumericx.a $^
|
||||
ranlib $@
|
||||
@make lib-dirs
|
||||
ar -rcs lib/static/$@ $^
|
||||
|
||||
libs: libnumericx.a
|
||||
numericx-pic.o: numericx.c numericx.h
|
||||
$(CC) $(CFLAGS) -fPIC -c numericx.c -o $@
|
||||
|
||||
libnumericx.so: numericx-pic.o
|
||||
@make lib-dirs
|
||||
$(CC) -shared $^ -o lib/shared/$@
|
||||
|
||||
.PHONY: libs
|
||||
libs: libnumericx.a libnumericx.so
|
||||
|
||||
.PHONY: doc
|
||||
doc:
|
||||
rm -Rf doc/*
|
||||
doxygen
|
||||
|
||||
decimal-to-earth: $(DEP)
|
||||
$(CC) $(CFLAGS) -DFROM_NUMERICALS=\"0123456789\" -DFROM_FIRST_NUMBER_VOID -DFROM_INFINITE_BASE -DTO_NUMERICALS=\"12345\" -o $@ $^
|
||||
|
@ -64,7 +81,7 @@ uninfinity: $(DEP)
|
|||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
\rm -f *-to-* uninfinity *.o *.a
|
||||
\rm -f *-to-* uninfinity *.o lib/static/*.a lib/shared/*.so
|
||||
|
||||
.PHONY: run
|
||||
run: decimal-to-earth
|
||||
|
@ -78,7 +95,7 @@ mem1: decimal-to-earth
|
|||
valgrind --leak-check=full --show-leak-kinds=all -s decimal-to-earth 999
|
||||
|
||||
mem2: decimal-to-earth
|
||||
valgrind --leak-check=full --show-leak-kinds=all -s decimal-to-earth 0
|
||||
valgrind --leak-check=full --show-leak-kinds=all -s decimal-to-earth 000
|
||||
|
||||
mem3: decimal-to-earth
|
||||
valgrind --leak-check=full --show-leak-kinds=all -s decimal-to-earth abc
|
||||
|
|
|
@ -26,7 +26,7 @@ if you want the units place of this numerical system to be on the right side, us
|
|||
|
||||
Now, to create the executable to translate a number for these two numerical system, join all of this together and compile using this:
|
||||
```
|
||||
$ c99 -DFROM_NUMERICALS=\"0123456789abcdef\" -DFROM_FIRST_NUMBER_VOID -DFROM_INFINITE_BASE -DFROM_UNITS_ON_THE_END -DTO_NUMERICALS=\"123\" -DTO_UNITS_ON_THE_END numericx.c -o hex-to-ternary
|
||||
$ cc -DFROM_NUMERICALS=\"0123456789abcdef\" -DFROM_FIRST_NUMBER_VOID -DFROM_INFINITE_BASE -DFROM_UNITS_ON_THE_END -DTO_NUMERICALS=\"123\" -DTO_UNITS_ON_THE_END numericx.c -o hex-to-ternary
|
||||
```
|
||||
|
||||
This creates the `hex-to-ternary` executable with can be used to convert numbers from hexadecimal to ternary!
|
||||
|
|
2
doc
2
doc
|
@ -1 +1 @@
|
|||
Subproject commit 2fe4a7ab4b3ea7480675e752526944407f4c0731
|
||||
Subproject commit dda4bf1fbfc8a4f7be10ce11265a44042bc452ba
|
Loading…
Reference in New Issue