···160160 * be INIT_ATTR. These functions must not be called after the final call
161161 * to root_menu() at the end of main()
162162 * see definition of INIT_ATTR in config.h */
163163-#ifdef HAVE_ARGV_MAIN
163163+#if defined(HAVE_ARGV_MAIN) && !defined(ZIG_APP)
164164int main(int argc, char *argv[]) INIT_ATTR MAIN_NORETURN_ATTR ;
165165int main(int argc, char *argv[])
166166{
167167 sys_handle_argv(argc, argv);
168168+#elif defined(ZIG_APP)
169169+int main_c(void) INIT_ATTR MAIN_NORETURN_ATTR;
170170+int main_c(void)
171171+{
168172#else
169173int main(void) INIT_ATTR MAIN_NORETURN_ATTR;
170174int main(void)
+8
apps/plugins/brickmania.c
···365365#elif CONFIG_KEYPAD == SHANLING_Q1_PAD
366366#define QUIT BUTTON_POWER
367367368368+#elif CONFIG_KEYPAD == SDL_PAD
369369+#define QUIT BUTTON_BACK
370370+#define LEFT BUTTON_LEFT
371371+#define RIGHT BUTTON_RIGHT
372372+#define SELECT BUTTON_SELECT
373373+#define UP BUTTON_UP
374374+#define DOWN BUTTON_DOWN
375375+368376#else
369377#error No keymap defined!
370378#endif
···11const std = @import("std");
2233-pub fn main() !void {
44- var gpa = std.heap.GeneralPurposeAllocator(.{}){};
55- const allocator = gpa.allocator();
66-77- var file = try std.fs.cwd().openFile("build/make.dep", .{});
88- defer file.close();
99-1010- var buffered = std.io.bufferedReader(file.reader());
1111- var reader = buffered.reader();
33+extern fn main_c() c_int;
1241313- var arr = std.ArrayList(u8).init(allocator);
1414- defer arr.deinit();
1515-1616- var line_count: usize = 0;
1717- var byte_count: usize = 0;
1818- while (true) {
1919- reader.streamUntilDelimiter(arr.writer(), '\n', null) catch |err| switch (err) {
2020- error.EndOfStream => break,
2121- else => return err,
2222- };
2323- line_count += 1;
2424- byte_count += arr.items.len;
2525-2626- //if (std.mem.containsAtLeast(u8, arr.items, 1, ".c \\")) {
2727- // std.debug.print("{s}\n", .{arr.items});
2828- //}
2929-3030- arr.clearRetainingCapacity();
3131- }
3232- std.debug.print("{d} lines, {d} bytes\n", .{ line_count, byte_count });
3333-3434- // Prints to stderr (it's a shortcut based on `std.io.getStdErr()`)
3535- std.debug.print("All your {s} are belong to us.\n", .{"codebase"});
3636-3737- // stdout is for the actual output of your application, for example if you
3838- // are implementing gzip, then only the compressed bytes should be sent to
3939- // stdout, not any debugging messages.
4040- const stdout_file = std.io.getStdOut().writer();
4141- var bw = std.io.bufferedWriter(stdout_file);
4242- const stdout = bw.writer();
4343-4444- try stdout.print("Run `zig build test` to run the tests.\n", .{});
4545-4646- try bw.flush(); // don't forget to flush!
4747-}
4848-4949-test "simple test" {
5050- var list = std.ArrayList(i32).init(std.testing.allocator);
5151- defer list.deinit(); // try commenting this out and see if zig detects the memory leak!
5252- try list.append(42);
5353- try std.testing.expectEqual(@as(i32, 42), list.pop());
55+pub fn main() !void {
66+ _ = main_c();
547}
+609
string.zig
···11+const std = @import("std");
22+const assert = std.debug.assert;
33+const builtin = @import("builtin");
44+55+/// A variable length collection of characters
66+pub const String = struct {
77+ /// The internal character buffer
88+ buffer: ?[]u8,
99+ /// The allocator used for managing the buffer
1010+ allocator: std.mem.Allocator,
1111+ /// The total size of the String
1212+ size: usize,
1313+1414+ /// Errors that may occur when using String
1515+ pub const Error = error{
1616+ OutOfMemory,
1717+ InvalidRange,
1818+ };
1919+2020+ /// Creates a String with an Allocator
2121+ /// ### example
2222+ /// ```zig
2323+ /// var str = String.init(allocator);
2424+ /// // don't forget to deallocate
2525+ /// defer _ = str.deinit();
2626+ /// ```
2727+ /// User is responsible for managing the new String
2828+ pub fn init(allocator: std.mem.Allocator) String {
2929+ // for windows non-ascii characters
3030+ // check if the system is windows
3131+ if (builtin.os.tag == std.Target.Os.Tag.windows) {
3232+ _ = std.os.windows.kernel32.SetConsoleOutputCP(65001);
3333+ }
3434+3535+ return .{
3636+ .buffer = null,
3737+ .allocator = allocator,
3838+ .size = 0,
3939+ };
4040+ }
4141+4242+ pub fn init_with_contents(allocator: std.mem.Allocator, contents: []const u8) Error!String {
4343+ var string = init(allocator);
4444+4545+ try string.concat(contents);
4646+4747+ return string;
4848+ }
4949+5050+ /// Deallocates the internal buffer
5151+ /// ### usage:
5252+ /// ```zig
5353+ /// var str = String.init(allocator);
5454+ /// // deinit after the closure
5555+ /// defer _ = str.deinit();
5656+ /// ```
5757+ pub fn deinit(self: *String) void {
5858+ if (self.buffer) |buffer| self.allocator.free(buffer);
5959+ }
6060+6161+ /// Returns the size of the internal buffer
6262+ pub fn capacity(self: String) usize {
6363+ if (self.buffer) |buffer| return buffer.len;
6464+ return 0;
6565+ }
6666+6767+ /// Allocates space for the internal buffer
6868+ pub fn allocate(self: *String, bytes: usize) Error!void {
6969+ if (self.buffer) |buffer| {
7070+ if (bytes < self.size) self.size = bytes; // Clamp size to capacity
7171+ self.buffer = self.allocator.realloc(buffer, bytes) catch {
7272+ return Error.OutOfMemory;
7373+ };
7474+ } else {
7575+ self.buffer = self.allocator.alloc(u8, bytes) catch {
7676+ return Error.OutOfMemory;
7777+ };
7878+ }
7979+ }
8080+8181+ /// Reallocates the the internal buffer to size
8282+ pub fn truncate(self: *String) Error!void {
8383+ try self.allocate(self.size);
8484+ }
8585+8686+ /// Appends a character onto the end of the String
8787+ pub fn concat(self: *String, char: []const u8) Error!void {
8888+ try self.insert(char, self.len());
8989+ }
9090+9191+ /// Inserts a string literal into the String at an index
9292+ pub fn insert(self: *String, literal: []const u8, index: usize) Error!void {
9393+ // Make sure buffer has enough space
9494+ if (self.buffer) |buffer| {
9595+ if (self.size + literal.len > buffer.len) {
9696+ try self.allocate((self.size + literal.len) * 2);
9797+ }
9898+ } else {
9999+ try self.allocate((literal.len) * 2);
100100+ }
101101+102102+ const buffer = self.buffer.?;
103103+104104+ // If the index is >= len, then simply push to the end.
105105+ // If not, then copy contents over and insert literal.
106106+ if (index == self.len()) {
107107+ var i: usize = 0;
108108+ while (i < literal.len) : (i += 1) {
109109+ buffer[self.size + i] = literal[i];
110110+ }
111111+ } else {
112112+ if (String.getIndex(buffer, index, true)) |k| {
113113+ // Move existing contents over
114114+ var i: usize = buffer.len - 1;
115115+ while (i >= k) : (i -= 1) {
116116+ if (i + literal.len < buffer.len) {
117117+ buffer[i + literal.len] = buffer[i];
118118+ }
119119+120120+ if (i == 0) break;
121121+ }
122122+123123+ i = 0;
124124+ while (i < literal.len) : (i += 1) {
125125+ buffer[index + i] = literal[i];
126126+ }
127127+ }
128128+ }
129129+130130+ self.size += literal.len;
131131+ }
132132+133133+ /// Removes the last character from the String
134134+ pub fn pop(self: *String) ?[]const u8 {
135135+ if (self.size == 0) return null;
136136+137137+ if (self.buffer) |buffer| {
138138+ var i: usize = 0;
139139+ while (i < self.size) {
140140+ const size = String.getUTF8Size(buffer[i]);
141141+ if (i + size >= self.size) break;
142142+ i += size;
143143+ }
144144+145145+ const ret = buffer[i..self.size];
146146+ self.size -= (self.size - i);
147147+ return ret;
148148+ }
149149+150150+ return null;
151151+ }
152152+153153+ /// Compares this String with a string literal
154154+ pub fn cmp(self: String, literal: []const u8) bool {
155155+ if (self.buffer) |buffer| {
156156+ return std.mem.eql(u8, buffer[0..self.size], literal);
157157+ }
158158+ return false;
159159+ }
160160+161161+ /// Returns the String buffer as a string literal
162162+ /// ### usage:
163163+ ///```zig
164164+ ///var mystr = try String.init_with_contents(allocator, "Test String!");
165165+ ///defer _ = mystr.deinit();
166166+ ///std.debug.print("{s}\n", .{mystr.str()});
167167+ ///```
168168+ pub fn str(self: String) []const u8 {
169169+ if (self.buffer) |buffer| return buffer[0..self.size];
170170+ return "";
171171+ }
172172+173173+ /// Returns an owned slice of this string
174174+ pub fn toOwned(self: String) Error!?[]u8 {
175175+ if (self.buffer != null) {
176176+ const string = self.str();
177177+ if (self.allocator.alloc(u8, string.len)) |newStr| {
178178+ std.mem.copyForwards(u8, newStr, string);
179179+ return newStr;
180180+ } else |_| {
181181+ return Error.OutOfMemory;
182182+ }
183183+ }
184184+185185+ return null;
186186+ }
187187+188188+ /// Returns a character at the specified index
189189+ pub fn charAt(self: String, index: usize) ?[]const u8 {
190190+ if (self.buffer) |buffer| {
191191+ if (String.getIndex(buffer, index, true)) |i| {
192192+ const size = String.getUTF8Size(buffer[i]);
193193+ return buffer[i..(i + size)];
194194+ }
195195+ }
196196+ return null;
197197+ }
198198+199199+ /// Returns amount of characters in the String
200200+ pub fn len(self: String) usize {
201201+ if (self.buffer) |buffer| {
202202+ var length: usize = 0;
203203+ var i: usize = 0;
204204+205205+ while (i < self.size) {
206206+ i += String.getUTF8Size(buffer[i]);
207207+ length += 1;
208208+ }
209209+210210+ return length;
211211+ } else {
212212+ return 0;
213213+ }
214214+ }
215215+216216+ /// Finds the first occurrence of the string literal
217217+ pub fn find(self: String, literal: []const u8) ?usize {
218218+ if (self.buffer) |buffer| {
219219+ const index = std.mem.indexOf(u8, buffer[0..self.size], literal);
220220+ if (index) |i| {
221221+ return String.getIndex(buffer, i, false);
222222+ }
223223+ }
224224+225225+ return null;
226226+ }
227227+228228+ /// Finds the last occurrence of the string literal
229229+ pub fn rfind(self: String, literal: []const u8) ?usize {
230230+ if (self.buffer) |buffer| {
231231+ const index = std.mem.lastIndexOf(u8, buffer[0..self.size], literal);
232232+ if (index) |i| {
233233+ return String.getIndex(buffer, i, false);
234234+ }
235235+ }
236236+237237+ return null;
238238+ }
239239+240240+ /// Removes a character at the specified index
241241+ pub fn remove(self: *String, index: usize) Error!void {
242242+ try self.removeRange(index, index + 1);
243243+ }
244244+245245+ /// Removes a range of character from the String
246246+ /// Start (inclusive) - End (Exclusive)
247247+ pub fn removeRange(self: *String, start: usize, end: usize) Error!void {
248248+ const length = self.len();
249249+ if (end < start or end > length) return Error.InvalidRange;
250250+251251+ if (self.buffer) |buffer| {
252252+ const rStart = String.getIndex(buffer, start, true).?;
253253+ const rEnd = String.getIndex(buffer, end, true).?;
254254+ const difference = rEnd - rStart;
255255+256256+ var i: usize = rEnd;
257257+ while (i < self.size) : (i += 1) {
258258+ buffer[i - difference] = buffer[i];
259259+ }
260260+261261+ self.size -= difference;
262262+ }
263263+ }
264264+265265+ /// Trims all whitelist characters at the start of the String.
266266+ pub fn trimStart(self: *String, whitelist: []const u8) void {
267267+ if (self.buffer) |buffer| {
268268+ var i: usize = 0;
269269+ while (i < self.size) : (i += 1) {
270270+ const size = String.getUTF8Size(buffer[i]);
271271+ if (size > 1 or !inWhitelist(buffer[i], whitelist)) break;
272272+ }
273273+274274+ if (String.getIndex(buffer, i, false)) |k| {
275275+ self.removeRange(0, k) catch {};
276276+ }
277277+ }
278278+ }
279279+280280+ /// Trims all whitelist characters at the end of the String.
281281+ pub fn trimEnd(self: *String, whitelist: []const u8) void {
282282+ self.reverse();
283283+ self.trimStart(whitelist);
284284+ self.reverse();
285285+ }
286286+287287+ /// Trims all whitelist characters from both ends of the String
288288+ pub fn trim(self: *String, whitelist: []const u8) void {
289289+ self.trimStart(whitelist);
290290+ self.trimEnd(whitelist);
291291+ }
292292+293293+ /// Copies this String into a new one
294294+ /// User is responsible for managing the new String
295295+ pub fn clone(self: String) Error!String {
296296+ var newString = String.init(self.allocator);
297297+ try newString.concat(self.str());
298298+ return newString;
299299+ }
300300+301301+ /// Reverses the characters in this String
302302+ pub fn reverse(self: *String) void {
303303+ if (self.buffer) |buffer| {
304304+ var i: usize = 0;
305305+ while (i < self.size) {
306306+ const size = String.getUTF8Size(buffer[i]);
307307+ if (size > 1) std.mem.reverse(u8, buffer[i..(i + size)]);
308308+ i += size;
309309+ }
310310+311311+ std.mem.reverse(u8, buffer[0..self.size]);
312312+ }
313313+ }
314314+315315+ /// Repeats this String n times
316316+ pub fn repeat(self: *String, n: usize) Error!void {
317317+ try self.allocate(self.size * (n + 1));
318318+ if (self.buffer) |buffer| {
319319+ for (1..n + 1) |i| {
320320+ std.mem.copyForwards(u8, buffer[self.size * i ..], buffer[0..self.size]);
321321+ }
322322+323323+ self.size *= (n + 1);
324324+ }
325325+ }
326326+327327+ /// Checks the String is empty
328328+ pub inline fn isEmpty(self: String) bool {
329329+ return self.size == 0;
330330+ }
331331+332332+ /// Splits the String into a slice, based on a delimiter and an index
333333+ pub fn split(self: *const String, delimiters: []const u8, index: usize) ?[]const u8 {
334334+ if (self.buffer) |buffer| {
335335+ var i: usize = 0;
336336+ var block: usize = 0;
337337+ var start: usize = 0;
338338+339339+ while (i < self.size) {
340340+ const size = String.getUTF8Size(buffer[i]);
341341+ if (size == delimiters.len) {
342342+ if (std.mem.eql(u8, delimiters, buffer[i..(i + size)])) {
343343+ if (block == index) return buffer[start..i];
344344+ start = i + size;
345345+ block += 1;
346346+ }
347347+ }
348348+349349+ i += size;
350350+ }
351351+352352+ if (i >= self.size - 1 and block == index) {
353353+ return buffer[start..self.size];
354354+ }
355355+ }
356356+357357+ return null;
358358+ }
359359+360360+ /// Splits the String into slices, based on a delimiter.
361361+ pub fn splitAll(self: *const String, delimiters: []const u8) ![][]const u8 {
362362+ var splitArr = std.ArrayList([]const u8).init(std.heap.page_allocator);
363363+ defer splitArr.deinit();
364364+365365+ var i: usize = 0;
366366+ while (self.split(delimiters, i)) |slice| : (i += 1) {
367367+ try splitArr.append(slice);
368368+ }
369369+370370+ return try splitArr.toOwnedSlice();
371371+ }
372372+373373+ /// Splits the String into a new string, based on delimiters and an index
374374+ /// The user of this function is in charge of the memory of the new String.
375375+ pub fn splitToString(self: *const String, delimiters: []const u8, index: usize) Error!?String {
376376+ if (self.split(delimiters, index)) |block| {
377377+ var string = String.init(self.allocator);
378378+ try string.concat(block);
379379+ return string;
380380+ }
381381+382382+ return null;
383383+ }
384384+385385+ /// Splits the String into a slice of new Strings, based on delimiters.
386386+ /// The user of this function is in charge of the memory of the new Strings.
387387+ pub fn splitAllToStrings(self: *const String, delimiters: []const u8) ![]String {
388388+ var splitArr = std.ArrayList(String).init(std.heap.page_allocator);
389389+ defer splitArr.deinit();
390390+391391+ var i: usize = 0;
392392+ while (try self.splitToString(delimiters, i)) |splitStr| : (i += 1) {
393393+ try splitArr.append(splitStr);
394394+ }
395395+396396+ return try splitArr.toOwnedSlice();
397397+ }
398398+399399+ /// Splits the String into a slice of Strings by new line (\r\n or \n).
400400+ pub fn lines(self: *String) ![]String {
401401+ var lineArr = std.ArrayList(String).init(std.heap.page_allocator);
402402+ defer lineArr.deinit();
403403+404404+ var selfClone = try self.clone();
405405+ defer selfClone.deinit();
406406+407407+ _ = try selfClone.replace("\r\n", "\n");
408408+409409+ return try selfClone.splitAllToStrings("\n");
410410+ }
411411+412412+ /// Clears the contents of the String but leaves the capacity
413413+ pub fn clear(self: *String) void {
414414+ if (self.buffer) |buffer| {
415415+ for (buffer) |*ch| ch.* = 0;
416416+ self.size = 0;
417417+ }
418418+ }
419419+420420+ /// Converts all (ASCII) uppercase letters to lowercase
421421+ pub fn toLowercase(self: *String) void {
422422+ if (self.buffer) |buffer| {
423423+ var i: usize = 0;
424424+ while (i < self.size) {
425425+ const size = String.getUTF8Size(buffer[i]);
426426+ if (size == 1) buffer[i] = std.ascii.toLower(buffer[i]);
427427+ i += size;
428428+ }
429429+ }
430430+ }
431431+432432+ /// Converts all (ASCII) uppercase letters to lowercase
433433+ pub fn toUppercase(self: *String) void {
434434+ if (self.buffer) |buffer| {
435435+ var i: usize = 0;
436436+ while (i < self.size) {
437437+ const size = String.getUTF8Size(buffer[i]);
438438+ if (size == 1) buffer[i] = std.ascii.toUpper(buffer[i]);
439439+ i += size;
440440+ }
441441+ }
442442+ }
443443+444444+ // Convert the first (ASCII) character of each word to uppercase
445445+ pub fn toCapitalized(self: *String) void {
446446+ if (self.size == 0) return;
447447+448448+ var buffer = self.buffer.?;
449449+ var i: usize = 0;
450450+ var is_new_word: bool = true;
451451+452452+ while (i < self.size) {
453453+ const char = buffer[i];
454454+455455+ if (std.ascii.isWhitespace(char)) {
456456+ is_new_word = true;
457457+ i += 1;
458458+ continue;
459459+ }
460460+461461+ if (is_new_word) {
462462+ buffer[i] = std.ascii.toUpper(char);
463463+ is_new_word = false;
464464+ }
465465+466466+ i += 1;
467467+ }
468468+ }
469469+470470+ /// Creates a String from a given range
471471+ /// User is responsible for managing the new String
472472+ pub fn substr(self: String, start: usize, end: usize) Error!String {
473473+ var result = String.init(self.allocator);
474474+475475+ if (self.buffer) |buffer| {
476476+ if (String.getIndex(buffer, start, true)) |rStart| {
477477+ if (String.getIndex(buffer, end, true)) |rEnd| {
478478+ if (rEnd < rStart or rEnd > self.size)
479479+ return Error.InvalidRange;
480480+ try result.concat(buffer[rStart..rEnd]);
481481+ }
482482+ }
483483+ }
484484+485485+ return result;
486486+ }
487487+488488+ // Writer functionality for the String.
489489+ pub usingnamespace struct {
490490+ pub const Writer = std.io.Writer(*String, Error, appendWrite);
491491+492492+ pub fn writer(self: *String) Writer {
493493+ return .{ .context = self };
494494+ }
495495+496496+ fn appendWrite(self: *String, m: []const u8) !usize {
497497+ try self.concat(m);
498498+ return m.len;
499499+ }
500500+ };
501501+502502+ // Iterator support
503503+ pub usingnamespace struct {
504504+ pub const StringIterator = struct {
505505+ string: *const String,
506506+ index: usize,
507507+508508+ pub fn next(it: *StringIterator) ?[]const u8 {
509509+ if (it.string.buffer) |buffer| {
510510+ if (it.index == it.string.size) return null;
511511+ const i = it.index;
512512+ it.index += String.getUTF8Size(buffer[i]);
513513+ return buffer[i..it.index];
514514+ } else {
515515+ return null;
516516+ }
517517+ }
518518+ };
519519+520520+ pub fn iterator(self: *const String) StringIterator {
521521+ return StringIterator{
522522+ .string = self,
523523+ .index = 0,
524524+ };
525525+ }
526526+ };
527527+528528+ /// Returns whether or not a character is whitelisted
529529+ fn inWhitelist(char: u8, whitelist: []const u8) bool {
530530+ var i: usize = 0;
531531+ while (i < whitelist.len) : (i += 1) {
532532+ if (whitelist[i] == char) return true;
533533+ }
534534+535535+ return false;
536536+ }
537537+538538+ /// Checks if byte is part of UTF-8 character
539539+ inline fn isUTF8Byte(byte: u8) bool {
540540+ return ((byte & 0x80) > 0) and (((byte << 1) & 0x80) == 0);
541541+ }
542542+543543+ /// Returns the real index of a unicode string literal
544544+ fn getIndex(unicode: []const u8, index: usize, real: bool) ?usize {
545545+ var i: usize = 0;
546546+ var j: usize = 0;
547547+ while (i < unicode.len) {
548548+ if (real) {
549549+ if (j == index) return i;
550550+ } else {
551551+ if (i == index) return j;
552552+ }
553553+ i += String.getUTF8Size(unicode[i]);
554554+ j += 1;
555555+ }
556556+557557+ return null;
558558+ }
559559+560560+ /// Returns the UTF-8 character's size
561561+ inline fn getUTF8Size(char: u8) u3 {
562562+ return std.unicode.utf8ByteSequenceLength(char) catch {
563563+ return 1;
564564+ };
565565+ }
566566+567567+ /// Sets the contents of the String
568568+ pub fn setStr(self: *String, contents: []const u8) Error!void {
569569+ self.clear();
570570+ try self.concat(contents);
571571+ }
572572+573573+ /// Checks the start of the string against a literal
574574+ pub fn startsWith(self: *String, literal: []const u8) bool {
575575+ if (self.buffer) |buffer| {
576576+ const index = std.mem.indexOf(u8, buffer[0..self.size], literal);
577577+ return index == 0;
578578+ }
579579+ return false;
580580+ }
581581+582582+ /// Checks the end of the string against a literal
583583+ pub fn endsWith(self: *String, literal: []const u8) bool {
584584+ if (self.buffer) |buffer| {
585585+ const index = std.mem.lastIndexOf(u8, buffer[0..self.size], literal);
586586+ const i: usize = self.size - literal.len;
587587+ return index == i;
588588+ }
589589+ return false;
590590+ }
591591+592592+ /// Replaces all occurrences of a string literal with another
593593+ pub fn replace(self: *String, needle: []const u8, replacement: []const u8) !bool {
594594+ if (self.buffer) |buffer| {
595595+ const InputSize = self.size;
596596+ const size = std.mem.replacementSize(u8, buffer[0..InputSize], needle, replacement);
597597+ defer self.allocator.free(buffer);
598598+ self.buffer = self.allocator.alloc(u8, size) catch {
599599+ return Error.OutOfMemory;
600600+ };
601601+ self.size = size;
602602+ const changes = std.mem.replace(u8, buffer[0..InputSize], needle, replacement, self.buffer.?);
603603+ if (changes > 0) {
604604+ return true;
605605+ }
606606+ }
607607+ return false;
608608+ }
609609+};
+32-30
tools/root.make
···233233 make.dep rombox.elf rombox.map rombox.bin romstart.txt \
234234 $(BINARY) $(FLASHFILE) uisimulator bootloader flash $(BOOTLINK) \
235235 rockbox.apk lang_enum.h rbversion.h
236236+ $(SILENT)rm -rf ../.zig-cache ../zig-out
236237237238#### linking the binaries: ####
238239···415416endif
416417417418zig: $(BUILDDIR)/lang/lang.h $(BUILDDIR)/lang_enum.h $(BUILDDIR)/lang/lang_core.c $(BUILDDIR)/lang/max_language_size.h $(BUILDDIR)/sysfont.o $(BUILDDIR)/rbversion.h $(PBMPHFILES) $(LUA_BUILDDIR)/actions.lua $(LUA_BUILDDIR)/settings.lua $(LUA_BUILDDIR)/buttons.lua $(LUA_BUILDDIR)/rb_defines.lua $(LUA_BUILDDIR)/sound_defines.lua $(LUA_BUILDDIR)/rocklib_aux.c $(BUILDDIR)/credits.raw credits.raw
418418- cd .. && zig build
419419+ cd .. && zig build all
419420help:
420421 @echo "A few helpful make targets"
421422 @echo ""
422422- @echo "all - builds a full Rockbox (default), including tools"
423423- @echo "bin - builds only the Rockbox.<target name> file"
424424- @echo "rocks - builds only plugins"
425425- @echo "codecs - builds only codecs"
426426- @echo "dep - regenerates make dependency database"
427427- @echo "clean - cleans a build directory (not tools)"
428428- @echo "veryclean - cleans the build and tools directories"
429429- @echo "manual - builds a manual (pdf)"
430430- @echo "manual-html - HTML manual"
431431- @echo "manual-zip - HTML manual (zipped)"
432432- @echo "manual-txt - txt manual"
433433- @echo "fullzip - creates a rockbox.zip of your build with fonts"
434434- @echo "zip - creates a rockbox.zip of your build (no fonts)"
435435- @echo "gzip - creates a rockbox.tar.gz of your build (no fonts)"
436436- @echo "bzip2 - creates a rockbox.tar.bz2 of your build (no fonts)"
437437- @echo "xz - creates a rockbox.tar.xz of your build (no fonts)"
438438- @echo "7zip - creates a rockbox.7z of your build (no fonts)"
439439- @echo "fontzip - creates rockbox-fonts.zip"
440440- @echo "mapzip - creates rockbox-maps.zip with all .map files"
441441- @echo "elfzip - creates rockbox-elfs.zip with all .elf files"
442442- @echo "pnd - creates rockbox.pnd archive (Pandora builds only)"
443443- @echo "tools - builds the tools only"
444444- @echo "voice - creates the voice clips (voice builds only)"
445445- @echo "voicetools - builds the voice tools only"
446446- @echo "talkclips - builds talkclips for everything under TALKDIR, skipping existing clips"
423423+ @echo "all - builds a full Rockbox (default), including tools"
424424+ @echo "zig - builds Rockbox with Zig"
425425+ @echo "bin - builds only the Rockbox.<target name> file"
426426+ @echo "rocks - builds only plugins"
427427+ @echo "codecs - builds only codecs"
428428+ @echo "dep - regenerates make dependency database"
429429+ @echo "clean - cleans a build directory (not tools)"
430430+ @echo "veryclean - cleans the build and tools directories"
431431+ @echo "manual - builds a manual (pdf)"
432432+ @echo "manual-html - HTML manual"
433433+ @echo "manual-zip - HTML manual (zipped)"
434434+ @echo "manual-txt - txt manual"
435435+ @echo "fullzip - creates a rockbox.zip of your build with fonts"
436436+ @echo "zip - creates a rockbox.zip of your build (no fonts)"
437437+ @echo "gzip - creates a rockbox.tar.gz of your build (no fonts)"
438438+ @echo "bzip2 - creates a rockbox.tar.bz2 of your build (no fonts)"
439439+ @echo "xz - creates a rockbox.tar.xz of your build (no fonts)"
440440+ @echo "7zip - creates a rockbox.7z of your build (no fonts)"
441441+ @echo "fontzip - creates rockbox-fonts.zip"
442442+ @echo "mapzip - creates rockbox-maps.zip with all .map files"
443443+ @echo "elfzip - creates rockbox-elfs.zip with all .elf files"
444444+ @echo "pnd - creates rockbox.pnd archive (Pandora builds only)"
445445+ @echo "tools - builds the tools only"
446446+ @echo "voice - creates the voice clips (voice builds only)"
447447+ @echo "voicetools - builds the voice tools only"
448448+ @echo "talkclips - builds talkclips for everything under TALKDIR, skipping existing clips"
447449 @echo "talkclips-force - builds talkclips for everything under TALKDIR, overwriting all existing clips"
448448- @echo "install - installs your build (at PREFIX, defaults to simdisk/ for simulators (no fonts))"
449449- @echo "fullinstall - installs your build (like install, but with fonts)"
450450- @echo "symlinkinstall - like fullinstall, but with links instead of copying files. (Good for developing on simulator)"
451451- @echo "reconf - rerun configure with the same selection"
450450+ @echo "install - installs your build (at PREFIX, defaults to simdisk/ for simulators (no fonts))"
451451+ @echo "fullinstall - installs your build (like install, but with fonts)"
452452+ @echo "symlinkinstall - like fullinstall, but with links instead of copying files. (Good for developing on simulator)"
453453+ @echo "reconf - rerun configure with the same selection"
452454453455### general compile rules:
454456