Hello World
- determine project structure - add makefile and main function
This commit is contained in:
56
.gitignore
vendored
56
.gitignore
vendored
@@ -1,54 +1,2 @@
|
||||
# ---> C
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Object files
|
||||
*.o
|
||||
*.ko
|
||||
*.obj
|
||||
*.elf
|
||||
|
||||
# Linker output
|
||||
*.ilk
|
||||
*.map
|
||||
*.exp
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Libraries
|
||||
*.lib
|
||||
*.a
|
||||
*.la
|
||||
*.lo
|
||||
|
||||
# Shared objects (inc. Windows DLLs)
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.i*86
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
||||
# Debug files
|
||||
*.dSYM/
|
||||
*.su
|
||||
*.idb
|
||||
*.pdb
|
||||
|
||||
# Kernel Module Compile Results
|
||||
*.mod*
|
||||
*.cmd
|
||||
.tmp_versions/
|
||||
modules.order
|
||||
Module.symvers
|
||||
Mkfile.old
|
||||
dkms.conf
|
||||
|
||||
obj/*
|
||||
Game
|
||||
|
||||
35
makefile
Executable file
35
makefile
Executable file
@@ -0,0 +1,35 @@
|
||||
INC = include
|
||||
OBJ = obj
|
||||
SRC = src
|
||||
EXE = Game
|
||||
|
||||
CC = gcc
|
||||
CFLAGS = -w -ggdb -I$(INC)
|
||||
LIBS = -lGLEW -lGLU -lGL -lSDL2 -lcglm -lz -lm
|
||||
|
||||
OBJFILES := $(patsubst $(SRC)/%.c, $(OBJ)/%.o, $(shell find $(SRC) -name '*.c'))
|
||||
OBJDIRS := $(patsubst $(SRC)%, $(OBJ)%, $(shell find $(SRC) -type d))
|
||||
CLEANDIRS := $(addsuffix /.clean, $(OBJDIRS));
|
||||
|
||||
# Explicit targets
|
||||
.PHONY: all clean
|
||||
.DEFAULT_GOAL := all
|
||||
|
||||
# Build executable
|
||||
all: $(EXE)
|
||||
$(EXE): $(OBJFILES) | $(OBJDIRS)
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
|
||||
|
||||
# Compile object files
|
||||
$(OBJ)/%.o: $(SRC)/%.c | $(OBJDIRS)
|
||||
$(CC) -c -o $@ $(SRC)/$*.c $(CFLAGS)
|
||||
|
||||
# Create obj directory tree if it doesn't exist
|
||||
$(OBJDIRS):
|
||||
mkdir -p $@
|
||||
|
||||
# Delete previously built files
|
||||
clean: $(CLEANDIRS)
|
||||
rm -f $(EXE)
|
||||
%.clean:
|
||||
rm -f $**.o
|
||||
6
src/main.c
Normal file
6
src/main.c
Normal file
@@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
printf("Hello World!\n");
|
||||
}
|
||||
Reference in New Issue
Block a user