Skip to content

Commit 56d4fe7

Browse files
committed
Reorganized default NOB_REBUILD_URSELF()
1 parent c6a668c commit 56d4fe7

1 file changed

Lines changed: 20 additions & 19 deletions

File tree

nob.h

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* nob - v2.0.1 - Public Domain - https://github.com/tsoding/nob.h
1+
/* nob - v2.1.0 - Public Domain - https://github.com/tsoding/nob.h
22
33
This library is the next generation of the [NoBuild](https://github.com/tsoding/nobuild) idea.
44
@@ -693,24 +693,22 @@ NOBDEF char *nob_temp_running_executable_path(void);
693693
// TODO: Maybe instead NOB_REBUILD_URSELF macro, the Go Rebuild Urself™ Technology should use the
694694
// user defined nob_cc_* macros instead?
695695
#ifndef NOB_REBUILD_URSELF
696-
# if defined(_WIN32)
697-
# if defined(__GNUC__)
698-
# if defined(__cplusplus)
699-
# define NOB_REBUILD_URSELF(binary_path, source_path) "gcc", "-x", "c++", "-o", binary_path, source_path
700-
# else
701-
# define NOB_REBUILD_URSELF(binary_path, source_path) "gcc", "-x", "c", "-o", binary_path, source_path
702-
# endif
703-
# elif defined(__clang__)
704-
# if defined(__cplusplus)
705-
# define NOB_REBUILD_URSELF(binary_path, source_path) "clang", "-x", "c++", "-o", binary_path, source_path
706-
# else
707-
# define NOB_REBUILD_URSELF(binary_path, source_path) "clang", "-x", "c", "-o", binary_path, source_path
708-
# endif
709-
# elif defined(_MSC_VER)
710-
# define NOB_REBUILD_URSELF(binary_path, source_path) "cl.exe", nob_temp_sprintf("/Fe:%s", (binary_path)), source_path
711-
# elif defined(__TINYC__)
712-
# define NOB_REBUILD_URSELF(binary_path, source_path) "tcc", "-o", binary_path, source_path
696+
# if defined(_MSC_VER)
697+
# define NOB_REBUILD_URSELF(binary_path, source_path) "cl.exe", nob_temp_sprintf("/Fe:%s", (binary_path)), source_path
698+
# elif defined(__clang__)
699+
# if defined(__cplusplus)
700+
# define NOB_REBUILD_URSELF(binary_path, source_path) "clang", "-x", "c++", "-o", binary_path, source_path
701+
# else
702+
# define NOB_REBUILD_URSELF(binary_path, source_path) "clang", "-x", "c", "-o", binary_path, source_path
703+
# endif
704+
# elif defined(__GNUC__)
705+
# if defined(__cplusplus)
706+
# define NOB_REBUILD_URSELF(binary_path, source_path) "gcc", "-x", "c++", "-o", binary_path, source_path
707+
# else
708+
# define NOB_REBUILD_URSELF(binary_path, source_path) "gcc", "-x", "c", "-o", binary_path, source_path
713709
# endif
710+
# elif defined(__TINYC__)
711+
# define NOB_REBUILD_URSELF(binary_path, source_path) "tcc", "-o", binary_path, source_path
714712
# else
715713
# if defined(__cplusplus)
716714
# define NOB_REBUILD_URSELF(binary_path, source_path) "cc", "-x", "c++", "-o", binary_path, source_path
@@ -2568,7 +2566,10 @@ NOBDEF char *nob_temp_running_executable_path(void)
25682566
/*
25692567
Revision history:
25702568
2571-
2.0.1+ ( ) Fix C++ support (by @rexim)
2569+
2.1.0 ( ) Improve C++ support (by @rexim)
2570+
- Fix various C++ compilers warnings and complains throughout the code.
2571+
- Reimplement nob_cmd_append() without taking a pointer to temporary array (some C++ compilers don't like that)
2572+
- Make default NOB_REBUILD_URSELF() try to recompile with C++ if __cplusplus macro is defined
25722573
2.0.1 (2026-01-07) Fix Walk_Entry naming (by @Sinha-Ujjawal)
25732574
Using single String Builder in nob__walk_dir_opt_impl (by @Sinha-Ujjawal)
25742575
Add tcc to nob_cc_*() and NOB_REBUILD_URSELF() macros (by @vylsaz)

0 commit comments

Comments
 (0)