{"id":13535344,"url":"https://github.com/PistonDevelopers/rust-empty","last_synced_at":"2025-04-02T01:30:35.915Z","repository":{"id":12887424,"uuid":"15564089","full_name":"PistonDevelopers/rust-empty","owner":"PistonDevelopers","description":"A Makefile to get started with Rust (DEPRECATED)","archived":false,"fork":false,"pushed_at":"2018-04-02T16:50:16.000Z","size":127,"stargazers_count":184,"open_issues_count":0,"forks_count":22,"subscribers_count":46,"default_branch":"master","last_synced_at":"2024-08-02T08:10:08.772Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PistonDevelopers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-01-01T12:42:10.000Z","updated_at":"2023-09-05T14:17:32.000Z","dependencies_parsed_at":"2022-09-01T19:31:20.296Z","dependency_job_id":null,"html_url":"https://github.com/PistonDevelopers/rust-empty","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PistonDevelopers%2Frust-empty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PistonDevelopers%2Frust-empty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PistonDevelopers%2Frust-empty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PistonDevelopers%2Frust-empty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PistonDevelopers","download_url":"https://codeload.github.com/PistonDevelopers/rust-empty/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222788514,"owners_count":17037777,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T08:00:54.294Z","updated_at":"2024-11-02T23:31:19.181Z","avatar_url":"https://github.com/PistonDevelopers.png","language":"Makefile","funding_links":[],"categories":["代码"],"sub_categories":["构建系统"],"readme":"Rust-Empty\n==========\n\n*Notice: Rust-Empty is deprecated and replaced by Cargo, which comes with Rust*\n\nA Makefile to get started with Rust development.  \nMIT license (or just use it as you like).  \nRequires Linux or Mac OS X (with developer tools).  \nExperimental support for Mingw on Windows.\n\nIf you want to contact me, I often hang around in the #rust IRC channel (bvssvni)\n\nIt is recommended to install [Cargo](https://github.com/rust-lang/cargo)  \nCargo will replace a subset of the features of Rust-Empty over time.  \n\n##Example 1: Hello World\n\n1. Copy [Makefile](https://raw.githubusercontent.com/bvssvni/rust-empty/master/Makefile) to a new empty project folder.\n2. Open the Terminal and navigate to the project folder.\n3. `make nightly-install`\n4. `make run` to create and run \"hello world\"\n\nThe \"hello world\" example is created when there is no `src/main.rs`.\n\n##Example 2: New open source library\n\n1. Create new repository on Github.\n3. `git clone \u003curl\u003e`\n4. Copy `Makefile` to the folder.\n5. `make git-ignore`\n6. `make lib`\n7. Change `DEFAULT = help` to `DEFAULT = lib`\n\n##Example 3: Compile library on file changes\n\n1. Assuming you have set up the library and set the `DEFAULT` parameter properly\n2. `make watch` to generate the watch script\n3. `./watch.sh`\n4. Edit the source and save to do compilation\n\n##Example 4: Compile and run application on file changes\n\n1. Assuming you have set up the application properly\n2. `make watch` to generate the watch script\n3. `./watch.sh src \"make run\"`\n4. Edit the source and save to compile and run the application\n\nThis technique can be applied to running unit tests and benchmarks as well.\nTo chain commands, use the `\u0026\u0026` operator, for example `./watch.sh src \"make test-internal \u0026\u0026 bench-internal\"`.\n\n##Example 5: Compile example with conditional compilation\n\n1. Assume you have an example 'examples/hello.rs'\n2. Put `#[cfg(foo)]` in 'hello.rs' where you want want conditional compilation\n3. Type `make examples/hello.rs COMPILER_FLAGS+=\"--cfg foo\"`\n\nThe 'foo' part can be switched with any other flag.  \nYou can also have multiple flags and require more than one by using `#[cfg(foo, bar)]`.\nType `make examples/hello.rs COMPILER_FLAGS+=\"--cfg foo --cfg bar\"` to activate both.\n\n##What is Rust-Empty?\n\nRust-Empty is a user friendly Makefile/Bash setup tool for Rust programmers.  \nIt automates setup of directories and configuration files.  \nOnce setup is completed, replace or modify the Makefile to suit your needs.  \nThe Makefile works out of the box on Linux and OSX (with developer tools).  \nThe setup uses best practices and conventions learned from the Rust community.  \nPull requests/fixes are welcome!  \n\n*Latest feature: Build symlink dependencies!*\n\nWhat are these 'best practices'?\n\nFor example:\n\n* Put code in a `src/` directory\n* Add a `crate_id` attribute for your library\n* Deny missing doc attribute for library\n* A `.gitignore` to keep repository clean\n* Library dependencies should be in `target/deps` directory\n* Example programs better not be in the `src/` directory\n* Need a `-O` flag to compile optimized code\n* Dependencies, rust-nightly check through Travis CI etc.\n\n###Goals\n\n* Work on Linux, Mac OS X and Mingw on Windows\n* Convention by 'best practice' of Rust community\n* Features are optional, non-interfering and gives informative output\n* Integrate with other tools from Rust community\n\n###Non-Goals\n\n* Replace Cargo, the Rust package manager\n* Backward compatibility\n* Require any sort of internal configuration\n\n##Usage\n\n1. Create a new empty folder for your project.  \n2. Copy 'Makefile' to the project folder.  \n3. Open the Terminal window and navigate to the project folder.  \n4. Type 'make help'.  \n\n```\n--- rust-empty (0.7 000)\nmake run               - Runs executable\nmake exe               - Builds main executable\nmake lib               - Both static and dynamic library\nmake rlib              - Static library\nmake dylib             - Dynamic library\nmake test              - Tests library internally and externally\nmake test-internal     - Tests library internally\nmake test-external     - Tests library externally\nmake bench             - Benchmarks library internally and externally\nmake bench-internal    - Benchmarks library internally\nmake bench-external    - Benchmarks library externally\nmake doc               - Builds documentation for library\nmake git-ignore        - Setup files to be ignored by Git\nmake examples          - Builds examples\nmake cargo-exe         - Setup executable package\nmake cargo-lib         - Setup library package\nmake rust-ci-lib       - Setup Travis CI Rust library\nmake rust-ci-exe       - Setup Travis CI Rust executable\nmake rusti             - Setup 'rusti.sh' for interactive Rust\nmake watch             - Setup 'watch.sh' for compilation on save\nmake loc               - Count lines of code in src folder\nmake nightly-install   - Installs Rust nightly build\nmake nightly-uninstall - Uninstalls Rust nightly build\nmake clean             - Deletes binaries and documentation.\nmake clear-project     - WARNING: Deletes project files except 'Makefile'\nmake clear-git         - WARNING: Deletes Git setup\nmake symlink-build     - Creates a script for building dependencies\nmake symlink-info      - Symlinked libraries dependency info\nmake target-dir        - Creates directory for current target\n```\n\nAll the commands creates the files and folders necessary to compile.  \nFor example, if you type `make exe` it will add a hello-world program to `src/main.rs`.  \nYou can use `make clear-project` to revert back to just the 'Makefile'.  \n\n##Unit Testing \u0026 Benchmarking\n\nInternal unit tests and benchmarks are located in the same source as the library, `src/lib.rs`.  \nExternal unit tests and benchmarks are located in `src/test.rs`.  \n\n##Linking to Libraries\n\nThe directory `target/deps/` is linked by default. If you put Rust libraries in this directory it will link statically if there is an \".rlib\" file or dynamically if \".dylib\" (OSX), \".so\" (Linux) or \".dll\" (Window).\n\n##Symlinked Libraries\n\nA symlink is a file that points to another file.\nSymlinks are useful when working across multiple repositories and testing integration.\n\nUsing the command `ln -s \u003cfrom\u003e \u003cto\u003e`, you can link the output file from another project to the `target/deps/` folder.\n\nThe command `make symlink-info` creates a file `.symlink-info` that contains the file name, current commit, the remote origin url and which remote branches this commit is available. For more information about how to read '.symlink-info' files, see https://github.com/bvssvni/rust-empty/issues/114\n\nNOTICE: The `ln -s \u003cfrom\u003e \u003cto\u003e` for relative file names does not work on OSX. Use absolute file names instead. For example `ln -s /Users/myser/Desktop/mylibrary/target/x86_64-apple-darwin/lib/mylib.rlib target/x86_64-apple-darwin/mylib.rlib`. See https://github.com/bvssvni/rust-empty/issues/100\n\nThe command `make symlink-build` creates a file `build.sh` that can build projects by symlinks.  \nYou can type `./build.sh` to build just the project, or `./build.sh deps` to build everything.\n\n##Introduction To Rust\n\nRust is a programming language developed at Mozilla Research.  \n\n\u003ca href=\"https://github.com/bvssvni/rust-empty/issues/35\" target=\"_blank\"\u003eRust nightly builds\u003c/a\u003e  \n\u003ca href=\"https://en.wikipedia.org/wiki/Rust_%28programming_language%29\" target=\"_blank\"\u003eRust at wikipedia\u003c/a\u003e  \n\u003ca href=\"http://www.rust-lang.org/\" target=\"_blank\"\u003eOfficial web page\u003c/a\u003e  \n\u003ca href=\"https://github.com/mozilla/rust/wiki/Docs\" target=\"_blank\"\u003eDocumentation at Github wiki\u003c/a\u003e  \n\u003ca href=\"http://www.reddit.com/r/rust/\" target=\"_blank\"\u003eRust at Reddit\u003c/a\u003e  \n\u003ca href=\"http://chat.mibbit.com/?server=irc.mozilla.org\u0026channel=%23rust\" target=\"_blank\"\u003eRust IRC channel\u003c/a\u003e  \n\u003ca href=\"https://github.com/mozilla/rust/wiki/Doc-packages%2C-editors%2C-and-other-tools\" target=\"_blank\"\u003eEditor syntax highlighting\u003c/a\u003e  \n\u003ca href=\"https://github.com/mozilla/rust/wiki/Rustpkg\" target=\"_blank\"\u003eRust packages\u003c/a\u003e  \n\n###For those new to terminal/Github:\n\n\u003ca href=\"https://github.com/bvssvni/rust-empty/wiki/How-to-use-the-terminal\" target=\"_blank\"\u003eHow to use the terminal\u003c/a\u003e  \n\u003ca href=\"https://github.com/bvssvni/rust-empty/wiki/How-to-use-Vim\" target=\"_blank\"\u003eHow to use Vim\u003c/a\u003e  \n\u003ca href=\"https://github.com/bvssvni/rust-empty/wiki/How-to-use-Github\" target=\"_blank\"\u003eHow to use Github\u003c/a\u003e\n\n###Rust CI\n\nEach night the latest version of Rust on Ubuntu is built against a list of projects.  \nAdd project by following instructions on the site:\n\n\u003ca href=\"http://rust-ci.org/\" target=\"_blank\"\u003eRust CI\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPistonDevelopers%2Frust-empty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPistonDevelopers%2Frust-empty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPistonDevelopers%2Frust-empty/lists"}