Skip to content

Commit

Permalink
Add a make command to uninstall the language
Browse files Browse the repository at this point in the history
  • Loading branch information
mertyildiran committed Apr 21, 2020
1 parent f66bd2c commit 9a4f0c2
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ jobs:
run: |
make test
- name: Uninstall
run: |
make uninstall
macos:
name: macos
runs-on: macos-latest
Expand Down Expand Up @@ -125,6 +129,11 @@ jobs:
run: |
make test
- name: Uninstall
run: |
source ~/.bash_profile
make uninstall
windows:
name: windows
runs-on: windows-latest
Expand Down Expand Up @@ -161,3 +170,8 @@ jobs:
shell: cmd
run: |
call make.bat test
- name: Uninstall
shell: cmd
run: |
call make.bat uninstall
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ clean:
install: requirements-dev
mv chaos /usr/local/bin/

uninstall:
rm /usr/local/bin/chaos
rm /usr/local/include/Chaos.h
rm -rf /usr/local/include/chaos/
ifeq ($(UNAME_S), Darwin)
$(eval GCC_VERSION=$(shell gcc -dumpversion))
$(eval GCC_MAJOR_VERSION=$(shell gcc -dumpversion | cut -d. -f1))
rm /usr/local/Cellar/gcc@$(GCC_MAJOR_VERSION)/$(GCC_VERSION)/lib/gcc/$(GCC_MAJOR_VERSION)/gcc/x86_64-apple-darwin19/$(GCC_VERSION)/include/Chaos.h
rm -rf /usr/local/Cellar/gcc@$(GCC_MAJOR_VERSION)/$(GCC_VERSION)/lib/gcc/$(GCC_MAJOR_VERSION)/gcc/x86_64-apple-darwin19/$(GCC_VERSION)/include/chaos/
endif

lint:
cppcheck --force .

Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ $ chaos dev.kaos
hello world
```

## Uninstallation

You can uninstall the `chaos` binary and its C headers with:

```
make uninstall
```

## Useful Links

[**Language Reference**](https://chaos-lang.org/docs/04_primitive-data-types)
Expand Down
34 changes: 34 additions & 0 deletions make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ IF [%1]==[] (
) ELSE (
EXIT /B 0
)
) ELSE IF [%1]==[uninstall] (
CALL :Uninstall
IF errorlevel 1 (
EXIT /B 1
) ELSE (
EXIT /B 0
)
) ELSE IF [%1]==[test] (
CALL tests\run.bat
IF errorlevel 1 (
Expand Down Expand Up @@ -140,3 +147,30 @@ IF errorlevel 1 (
EXIT /B 1
)
EXIT /B 0

:Uninstall
DEL %windir%\System32\chaos.exe
CALL RefreshEnv.cmd

gcc -dumpversion > tmpFile
SET /p GCC_VERSION= < tmpFile
DEL tmpFile

clang -dumpversion > tmpFile
SET /p CLANG_VERSION= < tmpFile
DEL tmpFile

ECHO "%programdata%\Chocolatey\lib\mingw\tools\install\mingw64\lib\gcc\x86_64-w64-mingw32\!GCC_VERSION!\include\"
DEL Chaos.h "%programdata%\Chocolatey\lib\mingw\tools\install\mingw64\lib\gcc\x86_64-w64-mingw32\!GCC_VERSION!\include\Chaos.h"
RMDIR /s /q "%programdata%\Chocolatey\lib\mingw\tools\install\mingw64\lib\gcc\x86_64-w64-mingw32\!GCC_VERSION!\include\chaos\"
IF errorlevel 1 (
EXIT /B 1
)

ECHO "%programfiles%\LLVM\lib\clang\!CLANG_VERSION!\include\"
DEL "%programfiles%\LLVM\lib\clang\!CLANG_VERSION!\include\Chaos.h"
RMDIR /s /q "%programfiles%\LLVM\lib\clang\!CLANG_VERSION!\include\chaos\"
IF errorlevel 1 (
EXIT /B 1
)
EXIT /B 0

0 comments on commit 9a4f0c2

Please sign in to comment.