fistcommit
This commit is contained in:
commit
80d8141b5a
8 changed files with 497 additions and 0 deletions
50
Makefile
Normal file
50
Makefile
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# --- Détection de l'OS et Chemins ---
|
||||
ifeq ($(OS),Windows_NT)
|
||||
# Chemins Windows pour les outils (utilisés par WSL)
|
||||
WATCOM := D:/WatCom
|
||||
NASM := C:/Program Files/NASM/nasm.exe
|
||||
CC := $(WATCOM)/binnt64/wcc386.exe
|
||||
AS := $(NASM)
|
||||
LINK := $(WATCOM)/binnt64/wlink.exe
|
||||
FIX_PATH = $(subst /,\,$1)
|
||||
else
|
||||
# Chemins Debian (à adapter selon ton install Linux)
|
||||
WATCOM := /opt/watcom
|
||||
CC := $(WATCOM)/binl64/wcc386
|
||||
AS := nasm
|
||||
LINK := $(WATCOM)/binl64/wlink
|
||||
FIX_PATH = $1
|
||||
endif
|
||||
|
||||
# --- Configuration ---
|
||||
INC_DIRS := -i="$(WATCOM)/h" -i="$(WATCOM)/CustomH"
|
||||
LIB_DIRS := libpath "$(WATCOM)/lib386" libpath "$(WATCOM)/lib386/dos" libpath "$(WATCOM)/CustomLib"
|
||||
CFLAGS := -bt=dos -6r -fp6 -ox -oh -ot -ei -zp8 $(INC_DIRS)
|
||||
LFLAGS := system dos4g $(LIB_DIRS)
|
||||
|
||||
# --- Détection AUTOMATIQUE des sources ---
|
||||
# Cherche récursivement tous les .cpp, .c et .asm dans src/
|
||||
SRC_CPP := $(shell find src -name "*.cpp")
|
||||
SRC_ASM := $(shell find src -name "*.asm")
|
||||
|
||||
# Génère la liste des objets correspondants dans build/
|
||||
OBJS := $(patsubst src/%.cpp, build/%.obj, $(SRC_CPP))
|
||||
OBJS += $(patsubst src/%.asm, build/%.obj, $(SRC_ASM))
|
||||
|
||||
# --- Règles ---
|
||||
all: build/app.exe
|
||||
|
||||
# Création du dossier build miroir de src
|
||||
build/%.obj: src/%.cpp
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) $(CFLAGS) $< -fo=$(call FIX_PATH,$@)
|
||||
|
||||
build/%.obj: src/%.asm
|
||||
@mkdir -p $(dir $@)
|
||||
$(AS) -f obj $< -o $(call FIX_PATH,$@)
|
||||
|
||||
build/app.exe: $(OBJS)
|
||||
$(LINK) $(LFLAGS) name $(call FIX_PATH,$@) file {$(foreach f,$(OBJS),$(call FIX_PATH,$f))}
|
||||
|
||||
clean:
|
||||
rm -rf build/*
|
||||
Loading…
Reference in a new issue