Skip to content

Commit

Permalink
make makefile linux aware
Browse files Browse the repository at this point in the history
  • Loading branch information
apache-hb committed Aug 12, 2024
1 parent 0cda7f2 commit 4adbd93
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 12 additions & 2 deletions data/examples/config/makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
CTC := $(CURDIR)/../../../build/src/frontend/cli/cli.exe
CTC := $(CURDIR)/../../../build/src/frontend/cli/cli

ifeq ($(OS),Windows_NT)
CC := cl.exe
else
CC := cc
endif

src = main.ct config.ct win32.ct cstdlib.ct

BUILDDIR := build
MAIN := $(BUILDDIR)/main.exe
MAIN := $(BUILDDIR)/main

SOURCES = $(BUILDDIR)/module.c $(BUILDDIR)/module.h

Expand All @@ -16,8 +21,13 @@ clean:
run: $(MAIN)
$(MAIN)

ifeq ($(OS),Windows_NT)
$(MAIN): $(SOURCES)
$(CC) /nologo $(BUILDDIR)/module.c /TC /Fe:$(MAIN) /DEBUG:FULL /Zi /Fo:$(BUILDDIR)/main.obj /Fd:$(BUILDDIR)/
else
$(MAIN): $(SOURCES)
$(CC) $(BUILDDIR)/module.c -o$(BUILDDIR)/main -Wno-format-security -Wno-format-contains-nul
endif

$(SOURCES): $(src) $(BUILDDIR)
$(CTC) $(src) /file-layout:pair /output-dir:$(BUILDDIR)
Expand Down
2 changes: 1 addition & 1 deletion data/examples/config/win32.ct
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,4 @@ export const PAGE_READONLY: DWORD = 0x02;

export const FILE_MAP_READ: DWORD = 0x04;
export const FILE_MAP_WRITE: DWORD = 0x02;
export const FILE_MAP_COPY: DWORD = 0x01;
export const FILE_MAP_COPY: DWORD = 0x01;

0 comments on commit 4adbd93

Please sign in to comment.